60 #define SET_EXPECTED_DOMAIN(node, dom) \ 63 (node)->expected_domain = (dom); \ 64 if ((node)->or_next) \ 66 PT_NODE *_or_next = (node)->or_next; \ 69 if (_or_next->type_enum == PT_TYPE_MAYBE && _or_next->expected_domain == NULL) \ 71 _or_next->expected_domain = (dom); \ 73 _or_next = _or_next->or_next; \ 79 #if defined(ENABLE_UNUSED_FUNCTION) 80 typedef struct generic_function_record
82 const char *function_name;
83 const char *return_type;
85 } GENERIC_FUNCTION_RECORD;
87 static int pt_Generic_functions_sorted = 0;
89 static GENERIC_FUNCTION_RECORD pt_Generic_functions[] = {
92 {
"AAA_DUMMY",
"integer", 0}
96 #define PT_ARE_COMPARABLE_CHAR_TYPE(typ1, typ2) \ 97 ((PT_IS_SIMPLE_CHAR_STRING_TYPE (typ1) && PT_IS_SIMPLE_CHAR_STRING_TYPE (typ2)) \ 98 || (PT_IS_NATIONAL_CHAR_STRING_TYPE (typ1) && PT_IS_NATIONAL_CHAR_STRING_TYPE (typ2))) 100 #define PT_ARE_COMPARABLE_NUMERIC_TYPE(typ1, typ2) \ 101 ((PT_IS_NUMERIC_TYPE (typ1) && PT_IS_NUMERIC_TYPE (typ2)) \ 102 || (PT_IS_NUMERIC_TYPE (typ1) && typ2 == PT_TYPE_MAYBE) \ 103 || (typ1 == PT_TYPE_MAYBE && PT_IS_NUMERIC_TYPE (typ2))) 106 #define PT_ARE_COMPARABLE(typ1, typ2) \ 107 ((typ1 == typ2) || PT_ARE_COMPARABLE_CHAR_TYPE (typ1, typ2) || PT_ARE_COMPARABLE_NUMERIC_TYPE (typ1, typ2)) 109 #define PT_IS_RECURSIVE_EXPRESSION(node) \ 110 ((node)->node_type == PT_EXPR && (PT_IS_LEFT_RECURSIVE_EXPRESSION (node) || PT_IS_RIGHT_RECURSIVE_EXPRESSION (node))) 112 #define PT_IS_LEFT_RECURSIVE_EXPRESSION(node) \ 113 ((node)->info.expr.op == PT_GREATEST || (node)->info.expr.op == PT_LEAST || (node)->info.expr.op == PT_COALESCE) 115 #define PT_IS_RIGHT_RECURSIVE_EXPRESSION(node) \ 116 ((node)->info.expr.op == PT_CASE || (node)->info.expr.op == PT_DECODE) 118 #define PT_IS_CAST_MAYBE(node) \ 119 ((node)->node_type == PT_EXPR && (node)->info.expr.op == PT_CAST \ 120 && (node)->info.expr.arg1 != NULL && (node)->info.expr.arg1->type_enum == PT_TYPE_MAYBE) 122 #define PT_NODE_IS_SESSION_VARIABLE(node) \ 123 ((((node) != NULL) && \ 124 ((node)->node_type == PT_EXPR) && \ 125 (((node)->info.expr.op == PT_EVALUATE_VARIABLE) || \ 126 (((node)->info.expr.op == PT_CAST) && \ 127 ((node)->info.expr.arg1 != NULL) && \ 128 ((node)->info.expr.arg1->node_type == PT_EXPR) && \ 129 ((node)->info.expr.arg1->info.expr.op == PT_EVALUATE_VARIABLE)) \ 153 #define COMPARE_BETWEEN_OPERATOR_COUNT \ 154 sizeof(pt_Compare_between_operator_table) / \ 155 sizeof(COMPARE_BETWEEN_OPERATOR) 157 #define PT_COLL_WRAP_TYPE_FOR_MAYBE(type) \ 158 ((PT_IS_CHAR_STRING_TYPE (type)) ? (type) : PT_TYPE_VARCHAR) 161 #define MAX_OVERLOADS 16 225 static bool does_op_specially_treat_null_arg (
PT_OP_TYPE op);
234 static bool pt_is_range_expression (
const PT_OP_TYPE op);
242 static PT_TYPE_ENUM pt_get_common_collection_type (
const PT_NODE *
set,
bool * is_multitype);
243 static bool pt_is_collection_of_type (
const PT_NODE * collection,
const PT_TYPE_ENUM collection_type,
245 static bool pt_is_symmetric_type (
const PT_TYPE_ENUM type_enum);
259 static bool pt_is_able_to_determine_return_type (
const PT_OP_TYPE op);
274 static const char *pt_class_name (
const PT_NODE *
type);
280 bool implicit_coercion);
281 #if defined(ENABLE_UNUSED_FUNCTION) 282 static int generic_func_casecmp (
const void *
a,
const void *
b);
283 static void init_generic_funcs (
void);
292 static bool pt_is_op_with_forced_common_type (
PT_OP_TYPE op);
295 static bool pt_is_range_or_comp (
PT_OP_TYPE op);
296 static bool pt_is_op_w_collation (
const PT_OP_TYPE op);
301 bool * is_first_element);
304 bool use_collate_modifier,
PT_TYPE_ENUM wrap_type_for_maybe,
307 const INTL_CODESET codeset,
bool force_mode,
bool use_collate_modifier,
319 static void pt_fix_arguments_collation_flag (
PT_NODE * expr);
5089 if (def_type ==
node->type_enum)
5188 if (new_node ==
NULL)
5228 if (data_type ==
NULL)
5246 if (new_node ==
NULL)
5302 if (def_type.
val.
type == op_type)
5454 if (expected_domain !=
NULL)
5459 common_type = arg1_eq_type;
5466 common_type = pt_common_type_op (arg1_eq_type, op, arg2_eq_type);
5475 arg2_eq_type = arg1_eq_type;
5476 common_type = arg1_eq_type;
5480 arg1_eq_type = arg2_eq_type;
5481 common_type = arg2_eq_type;
5491 common_type = pt_common_type_op (common_type, op, arg3_eq_type);
5499 common_type = arg1_eq_type;
5500 arg3_eq_type = common_type;
5505 arg1_eq_type = arg3_eq_type;
5506 arg2_eq_type = arg3_eq_type;
5507 common_type = arg3_eq_type;
5515 common_type = expected_type;
5544 pt_get_common_collection_type (
const PT_NODE *
set,
bool * is_multitype)
5547 bool is_multitype_temp =
false;
5565 for (data_type = data_type->
next; data_type; data_type = data_type->
next)
5571 is_multitype_temp =
true;
5579 *is_multitype = is_multitype_temp;
5605 if (
node->type_enum != collection_type)
5611 for (temp =
node->data_type; temp; temp = temp->
next)
5667 arg1_eq_type = pt_get_equivalent_type (sig.
arg1_type, arg1_type);
5668 arg2_eq_type = pt_get_equivalent_type (sig.
arg2_type, arg2_type);
5669 arg3_eq_type = pt_get_equivalent_type (sig.
arg3_type, arg3_type);
5694 if (pt_is_enumeration_special_comparison (arg1, op, arg2))
5702 common_type = pt_common_type_op (arg1_eq_type, op, arg2_type);
5712 arg1_eq_type = arg1_type;
5716 arg1_eq_type = common_type;
5720 arg2_eq_type = arg2_type;
5724 arg2_eq_type = common_type;
5727 error = pt_coerce_expression_argument (
parser, expr, &arg1, arg1_eq_type,
NULL);
5752 bool should_cast =
false;
5755 if (pt_is_enumeration_special_comparison (arg1, op, arg2))
5763 common_type = collection_type = pt_get_common_collection_type (arg2, &should_cast);
5766 common_type = pt_common_type_op (arg1_eq_type, op, common_type);
5769 arg1_eq_type = common_type;
5778 msg_temp =
parser->error_msgs;
5784 parser->error_msgs = msg_temp;
5796 msg_temp =
parser->error_msgs;
5803 parser->error_msgs = msg_temp;
5814 arg1_eq_type = arg1_type;
5818 error = pt_coerce_expression_argument (
parser, expr, &arg1, arg1_eq_type,
NULL);
5829 && (collection_type == common_type
5838 if (data_type ==
NULL)
5849 bool keep_searching =
true;
5857 switch (common_type)
5877 keep_searching =
false;
5892 keep_searching =
false;
5904 if (precision < temp->
info.data_type.precision)
5908 if (scale < temp->
info.data_type.dec_precision)
5949 error = pt_coerce_expression_argument (
parser, expr, &arg1, arg1_eq_type,
NULL);
6009 arg2_type = pt_get_common_arg_type_of_width_bucket (
parser, expr);
6019 arg1_eq_type = pt_get_equivalent_type_with_op (sig.
arg1_type, arg1_type, op);
6020 arg2_eq_type = pt_get_equivalent_type_with_op (sig.
arg2_type, arg2_type, op);
6021 arg3_eq_type = pt_get_equivalent_type_with_op (sig.
arg3_type, arg3_type, op);
6025 if (pt_is_enumeration_special_comparison (arg1, op, arg2))
6034 common_type = pt_infer_common_type (op, &arg1_eq_type, &arg2_eq_type, &arg3_eq_type, expr->
expected_domain);
6043 if (pt_is_range_or_comp (op)
6051 arg1_eq_type = arg2_eq_type = arg1_type;
6054 arg3_eq_type = arg1_type;
6062 if (arg2_type != arg1_type)
6066 if (arg3_type !=
PT_TYPE_NONE && arg3_type != arg1_type)
6075 arg1_eq_type = arg2_eq_type = arg2_type;
6089 arg1_eq_type = arg1_type;
6093 arg2_eq_type = arg2_type;
6097 arg3_eq_type = arg3_type;
6113 if (pt_is_symmetric_type (common_type))
6115 if (arg1_eq_type != common_type && arg1_eq_type !=
PT_TYPE_NONE)
6118 arg1_type = common_type;
6120 if (arg2_type != common_type && arg2_eq_type !=
PT_TYPE_NONE)
6123 arg2_type = common_type;
6156 error = pt_coerce_expression_argument (
parser, expr, &arg1, arg1_eq_type, arg1_dt);
6178 error = pt_coerce_expression_argument (
parser, expr, &arg2, arg2_eq_type, arg2_dt);
6209 error = pt_coerce_expression_argument (
parser, between_ge_lt, &
b1, arg2_eq_type, arg1_dt);
6219 error = pt_coerce_expression_argument (
parser, between_ge_lt, &b2, arg2_eq_type, arg2_dt);
6234 error = pt_coerce_expression_argument (
parser, expr, &arg3, arg3_eq_type, arg3_dt);
6314 does_op_specially_treat_null_arg (
PT_OP_TYPE op)
6363 int matches = 0, best_match = -1,
i = 0;
6371 if (!pt_get_expression_definition (op, &def))
6396 arg2_type = pt_get_common_arg_type_of_width_bucket (
parser, expr);
6409 if (!does_op_specially_treat_null_arg (op)
6411 || (arg2 && !arg2->is_added_by_parser && arg2_type ==
PT_TYPE_NULL)
6412 || (arg3 && !arg3->is_added_by_parser && arg3_type ==
PT_TYPE_NULL)))
6455 else if (match_cnt > matches)
6457 matches = match_cnt;
6462 if (best_match == -1)
6470 if (pt_is_range_expression (op))
6474 expr = pt_coerce_range_expr_arguments (
parser, expr, arg1, arg2, arg3, sig);
6478 expr = pt_coerce_expr_arguments (
parser, expr, arg1, arg2, arg3, sig);
6492 expr->
type_enum = pt_expr_get_return_type (expr, sig);
6587 common_type = arg1_type;
6607 common_type = arg2_type;
6631 type.is_generic =
true;
6634 if (pt_are_equivalent_types (
type, arg1_type) || pt_are_equivalent_types (
type, arg2_type)
6635 || pt_are_equivalent_types (
type, arg3_type))
6964 if (!expr || !otype1 || !otype2)
7101 PT_NODE *cnf_node, *dnf_node, *cnf_prev, *dnf_prev;
7114 while ((cnf_node = ((cnf_prev) ? cnf_prev->
next : where)))
7170 if (cnf_node == where && cnf_node->
next ==
NULL)
7182 while ((dnf_node = ((dnf_prev) ? dnf_prev->
or_next : cnf_node)))
7213 cnf_node = cnf_prev->
next;
7240 dnf_prev = (dnf_prev) ? dnf_prev->
or_next : dnf_node;
7253 where = cnf_node->
next;
7260 cnf_prev = (cnf_prev) ? cnf_prev->
next : cnf_node;
7278 where->line_number =
line;
7279 where->column_number =
column;
7281 where->info.value.data_value.i = 0;
7282 where->info.value.location = location;
7298 if (where ==
NULL && save_where !=
NULL)
7329 switch (
node->node_type)
7339 if (
node->info.query.q.select.start_with)
7341 where =
node->info.query.q.select.start_with;
7347 if (
node->info.query.q.select.after_cb_filter)
7349 where =
node->info.query.q.select.after_cb_filter;
7356 if (
node->info.query.orderby_for)
7358 where =
node->info.query.orderby_for;
7370 if (
node->info.query.q.select.group_by)
7372 where =
node->info.query.q.select.having;
7379 for (from =
node->info.query.q.select.from; from; from = from->
next)
7419 where =
node->info.query.q.select.where;
7423 where =
node->info.update.search_cond;
7427 where =
node->info.delete_.search_cond;
7431 where =
node->info.merge.search_cond;
7458 &&
node->info.value.data_value.i == 0)))
7480 const char *alias_print;
7485 if (
node->info.query.has_outer_spec == 1 ||
node->info.query.is_sort_spec ||
node->info.query.is_insert_select)
7495 subq = &(
node->info.query.q.select);
7503 for (
i = 0;
i < col_cnt;
i++)
7549 if (
node->info.query.order_by && !
node->info.query.q.select.connect_by)
7555 if (
node->info.query.orderby_for)
7558 node->info.query.orderby_for =
NULL;
7561 node->info.query.correlation_level = 0;
7605 int hidden =
node->is_hidden_column;
7611 alias_print =
node->alias_print;
7625 node->alias_print = alias_print;
7627 node->info.value.location = 0;
7628 node->is_hidden_column = hidden;
7646 if (recursive_expr ==
NULL)
7672 return pt_eval_expr_type (
parser, recursive_expr);
7697 switch (
node->node_type)
7700 derived_table =
node->info.spec.derived_table;
7721 node->info.sort_spec.expr->info.query.is_sort_spec = 1;
7729 arg1 =
node->info.query.q.union_.arg1;
7730 arg2 =
node->info.query.q.union_.arg2;
7735 if (
node->info.query.limit &&
node->info.query.rewrite_limit)
7744 if (
node->info.query.order_by !=
NULL)
7746 expr_pred = &
node->info.query.orderby_for;
7750 t_node = *expr_pred;
7753 t_node = t_node->
next;
7757 t_node = *expr_pred = limit;
7762 t_node->
next = limit;
7765 node->info.query.rewrite_limit = 0;
7777 if (
node->info.query.limit &&
node->info.query.rewrite_limit)
7782 if (
node->info.query.order_by)
7784 expr_pred = &
node->info.query.orderby_for;
7787 else if (
node->info.query.q.select.group_by)
7789 expr_pred = &
node->info.query.q.select.having;
7795 expr_pred = &
node->info.query.orderby_for;
7800 expr_pred = &
node->info.query.q.select.where;
7806 t_node = *expr_pred;
7809 t_node = t_node->
next;
7813 t_node = *expr_pred = limit;
7818 t_node->
next = limit;
7821 node->info.query.rewrite_limit = 0;
7834 node->info.insert.value_clauses->info.node_list.list->info.query.is_insert_select = 1;
7840 if (
node->info.delete_.limit &&
node->info.delete_.rewrite_limit)
7849 t_node = t_node->
next;
7853 node->info.delete_.search_cond = limit;
7858 t_node->
next = limit;
7861 node->info.delete_.rewrite_limit = 0;
7872 if (
node->info.update.limit &&
node->info.update.rewrite_limit)
7877 if (
node->info.update.order_by)
7879 expr_pred = &
node->info.update.orderby_for;
7884 expr_pred = &
node->info.update.search_cond;
7890 t_node = *expr_pred;
7893 t_node = t_node->
next;
7897 t_node = *expr_pred = limit;
7902 t_node->
next = limit;
7905 node->info.update.rewrite_limit = 0;
7918 bool has_enum =
false;
7956 *norm_arg = node_tmp;
7961 common_type = (*norm_arg)->type_enum;
7965 common_type =
pt_common_type (common_type, (*norm_arg)->type_enum);
7979 *recurs_arg = node_tmp;
7984 common_type = (*recurs_arg)->type_enum;
7988 common_type =
pt_common_type (common_type, (*recurs_arg)->type_enum);
8005 recurs_expr = *recurs_arg;
8081 switch (
node->node_type)
8120 switch (
node->node_type)
8164 if (
parser->set_host_var == 0)
8172 for (list =
node->info.merge.insert.value_clauses; list !=
NULL; list = list->
next)
8174 attr =
node->info.merge.insert.attr_list;
8190 if (
node->info.query.q.select.list)
8199 list =
node->info.query.q.select.list->info.node_list.list;
8207 node->type_enum =
node->info.query.q.select.list->type_enum;
8208 dt =
node->info.query.q.select.list->data_type;
8213 if (
node->data_type)
8222 for (spec =
node->info.query.q.select.from; spec; spec = spec->
next)
8232 is_subquery =
node->info.query.is_subquery;
8252 if (
node->info.do_.expr)
8254 node->type_enum =
node->info.do_.expr->type_enum;
8255 dt =
node->info.do_.expr->data_type;
8258 if (
node->data_type)
8269 if (
node->info.insert.spec)
8276 node->data_type = dt;
8281 if (
parser->set_host_var == 0)
8288 for (list =
node->info.insert.value_clauses; list !=
NULL; list = list->
next)
8290 attr =
node->info.insert.attr_list;
8322 arg1 =
node->info.cte.non_recursive_part;
8323 arg2 =
node->info.cte.recursive_part;
8328 arg2 =
node->info.cte.recursive_part =
NULL;
8339 arg1 =
node->info.query.q.union_.arg1;
8340 arg2 =
node->info.query.q.union_.arg2;
8358 node->type_enum = arg1->type_enum;
8406 if (
node->info.query.q.select.list &&
node->info.query.q.select.list->
next)
8414 pt_chop_to_one_select_item (
parser,
node->info.query.q.union_.arg1);
8415 pt_chop_to_one_select_item (
parser,
node->info.query.q.union_.arg2);
8419 if (
node->info.query.order_by && !
node->info.query.q.select.connect_by)
8480 PT_NODE * data_type,
bool force_wrap)
8500 for (item = select_list; item !=
NULL; prev = item, item = item->
next)
8503 if (item->type_enum == new_type && !force_wrap)
8509 if (new_node ==
NULL)
8514 if (new_node != item)
8535 for (item = select_list; item !=
NULL; prev = item, item = item->
next)
8537 if (item->is_hidden_column)
8542 if (item->type_enum == new_type && !force_wrap)
8547 if (new_node ==
NULL)
8552 if (new_node != item)
8617 PT_NODE *new_att, *set_dt, *next_att;
8622 switch (
arg->info.function.function_type)
8628 PT_NODE **first = &
arg->info.function.arg_list, *arg_list = *first, *prev =
NULL;
8634 next_att = arg_list->
next;
8636 if ((set_data->
type_enum != arg_list->type_enum
8646 if (for_collation ==
false)
8669 prev->next = new_att;
8670 new_att->
next = next_att;
8680 arg_list = next_att;
8690 next_att =
arg->next;
8695 if (!new_att || !set_dt)
8717 new_att->
next = next_att;
8737 PT_NODE *new_att, *new_dt, *next_att;
8745 next_att =
arg->next;
8748 if (new_att ==
NULL)
8774 else if (desired_dt ==
NULL)
8814 new_att->
next = next_att;
8831 pt_hv_consistent_data_type_with_domain (
parser, hv_node);
8850 node->expected_domain = domain;
8851 _or_next =
node->or_next;
8869 pt_is_able_to_determine_return_type (
const PT_OP_TYPE op)
9019 assert (arg1_type != arg2_type);
9021 if (arg1_type == common_type)
9023 arg_base_type = arg1_type;
9025 arg_type = arg2_type;
9030 arg_base_type = arg2_type;
9032 arg_type = arg1_type;
9038 if (pt_coerce_str_to_time_date_utime_datetime (
parser, arg_ptr, &arg_type) ==
NO_ERROR)
9042 if (arg_type != arg_base_type)
9044 return pt_get_common_datetime_type (
parser, result_type, arg_base_type, arg_type, arg_base, arg_ptr);
9085 bool check_expr_coll =
true;
9091 op =
node->info.expr.op;
9092 if (pt_is_enumeration_special_comparison (
node->info.expr.arg1, op,
node->info.expr.arg2))
9100 op =
node->info.expr.op;
9113 func = pt_eval_function_type (
parser,
node->info.expr.arg1);
9128 arg1 =
node->info.expr.arg1;
9150 arg2 =
node->info.expr.arg2;
9153 if (arg2->or_next ==
NULL)
9155 arg2_type = arg2->type_enum;
9164 for (temp = arg2; temp; temp = temp->
or_next)
9172 arg2_type = common_type;
9181 if (arg2->node_type ==
PT_EXPR 9188 arg2_hv = arg2->info.expr.arg1;
9192 arg3 =
node->info.expr.arg3;
9195 arg3_type = arg3->type_enum;
9207 common_type = arg1_type;
9226 goto cannot_use_signature;
9252 node->info.expr.arg2 = arg2;
9253 node->type_enum = arg1_type;
9269 node->info.expr.arg1 = arg1;
9270 node->type_enum = arg2_type;
9283 goto cannot_use_signature;
9301 node->info.expr.arg2 = arg2;
9303 node->type_enum = arg1_type;
9323 arg2 =
node->info.expr.arg2;
9324 node->info.expr.arg2 = arg2->info.expr.arg1;
9325 node->info.expr.arg3 = arg2->info.expr.arg2;
9338 arg2 =
node->info.expr.arg2;
9339 node->info.expr.arg2 = arg2->info.expr.arg1;
9340 node->info.expr.arg3 = arg2->info.expr.arg2;
9359 && arg2->info.value.data_value.set->next ==
NULL)
9371 node->info.expr.arg2 = new_arg2;
9408 bool has_user_format =
false;
9409 bool has_user_lang =
false;
9410 const char *lang_str;
9420 arg3->info.value.data_value.i = lang_flag;
9421 arg3->info.value.db_value_is_initialized = 0;
9466 assert (check_expr_coll);
9475 check_expr_coll =
false;
9479 expr = pt_wrap_expr_w_exp_dom_cast (
parser, expr);
9493 arg2->info.expr.arg1 =
node->info.expr.arg2;
9494 arg2->info.expr.arg2 =
node->info.expr.arg3;
9495 node->info.expr.arg2 = arg2;
9507 arg2->info.expr.arg1 =
node->info.expr.arg2;
9508 arg2->info.expr.arg2 =
node->info.expr.arg3;
9509 node->info.expr.arg2 = arg2;
9520 arg1 =
node->info.expr.arg1;
9535 node->type_enum = arg1_type;
9539 int incompatible_extract_type =
false;
9542 switch (
node->info.expr.qualifier)
9584 incompatible_extract_type =
true;
9628 incompatible_extract_type =
true;
9651 incompatible_extract_type =
true;
9658 if (incompatible_extract_type)
9667 node->data_type->type_enum =
node->type_enum;
9690 if (arg2_type != arg1_type)
9729 if (arg1_hv != arg1)
9752 if (arg2_hv != arg2)
9756 arg2_type = arg2->type_enum = arg2_hv->type_enum;
9766 arg2_type = arg2->type_enum;
9775 if (pt_is_enumeration_special_comparison (arg1, op, arg2))
9783 common_type = pt_common_type_op (arg1_type, op, arg2_type);
9787 if (pt_is_symmetric_type (common_type))
9791 if (arg1_type != common_type)
9817 if (arg2 && arg2_type != common_type)
9834 arg2_type = arg2->type_enum;
9861 for (temp = arg2->info.function.arg_list; temp; temp = temp->
next)
9897 common_type =
node->or_next->type_enum;
9900 node->type_enum = common_type;
9902 if (
node->type_enum ==
PT_TYPE_MAYBE && pt_is_able_to_determine_return_type (op))
9920 if (
node->expected_domain
9937 if (arg2->data_type)
9939 p = arg2->data_type->info.data_type.precision;
9940 s = arg2->data_type->info.data_type.dec_precision;
9949 if (new_att ==
NULL)
9954 node->info.expr.arg1 = arg1 = new_att;
9955 arg1_type = arg2_type;
9972 if (
node->expected_domain
9984 if (arg2->node_type ==
PT_NAME)
10001 if (new_att ==
NULL)
10006 node->info.expr.arg2 = arg2 = new_att;
10007 arg2_type = arg1_type;
10043 if (
node->expected_domain !=
NULL)
10055 common_type = (arg2_type ==
PT_TYPE_MAYBE) ? arg3_type : arg2_type;
10066 common_type = arg2_type;
10070 common_type = arg3_type;
10083 node->info.expr.arg2 = arg2;
10090 node->info.expr.arg3 = arg3;
10091 node->type_enum = common_type;
10095 check_expr_coll =
true;
10107 check_expr_coll =
true;
10113 first_node = (arg3->next && arg3->next->info.value.data_value.i == 1);
10134 new_type = arg3_type;
10140 if (new_att ==
NULL)
10147 node->info.expr.arg1 = arg1 = new_att;
10148 arg1_type = new_type;
10152 if (new_att ==
NULL)
10159 node->info.expr.arg2 = arg2 = new_att;
10160 arg2_type = new_type;
10166 node->type_enum =
node->info.expr.arg1->type_enum;
10171 node->type_enum = arg1_type;
10192 pt_chop_to_one_select_item (
parser, arg1);
10222 int type_specifier = 0;
10248 if (new_att ==
NULL)
10258 node->info.expr.arg1 = arg1 = new_att;
10331 int is_single_unit;
10333 is_single_unit = (arg3
10335 || arg3->info.expr.qualifier ==
PT_MINUTE || arg3->info.expr.qualifier ==
PT_HOUR 10336 || arg3->info.expr.qualifier ==
PT_DAY || arg3->info.expr.qualifier ==
PT_WEEK 10338 || arg3->info.expr.qualifier ==
PT_YEAR));
10354 if (arg3->info.expr.qualifier ==
PT_DAY || arg3->info.expr.qualifier ==
PT_WEEK 10368 common_type =
node->type_enum;
10399 cast_type =
node->info.expr.cast_type;
10421 if (cast_type ==
NULL &&
node->expected_domain !=
NULL 10434 if (cast_type !=
NULL)
10436 node->info.expr.cast_type = cast_type;
10488 common_type =
node->info.expr.recursive_type;
10491 common_type = pt_common_type_op (arg1_type, op, arg2_type);
10513 node->type_enum = common_type;
10516 node->type_enum = common_type;
10517 if (arg1_type != common_type && arg1_type !=
PT_TYPE_NULL)
10525 node->info.expr.arg1 = arg1;
10528 if (arg2_type != common_type)
10546 if (arg1_type != common_type && arg1_type !=
PT_TYPE_NULL)
10548 if (pt_coerce_expression_argument (
parser, nextcase, &arg1, common_type,
NULL) !=
NO_ERROR)
10572 if (pt_coerce_expression_argument (
parser, prev, &nextcase, common_type,
NULL) !=
NO_ERROR)
10587 node->type_enum =
node->info.expr.arg1->type_enum;
10601 cannot_use_signature:
10604 expr = pt_wrap_expr_w_exp_dom_cast (
parser, expr);
10674 switch (
node->node_type)
10680 arg1 =
node->info.get_opt_lvl.args;
10702 arg1 =
node->info.set_opt_lvl.val;
10750 if (arg1_type == arg2_type)
10759 common_type = arg1_type;
10874 common_type = arg2_type;
10904 common_type = arg2_type;
10938 common_type = arg2_type;
11080 common_type = arg2_type;
11120 common_type = arg2_type;
11178 common_type = arg2_type;
11207 common_type = arg2_type;
11225 common_type = arg2_type;
11246 common_type = arg2_type;
11269 common_type = arg2_type;
11294 common_type = arg2_type;
11314 common_type = arg2_type;
11426 common_type = arg2_type;
11451 common_type = arg2_type;
11455 common_type = arg1_type;
11459 return common_type;
11585 return result_type;
11606 int arg1_dec_prec = 0;
11607 int arg1_units = 0;
11609 int arg2_dec_prec = 0;
11610 int arg2_units = 0;
11612 bool do_detect_collation =
true;
11615 if (
node->data_type)
11752 int integral_digits1, integral_digits2;
11754 integral_digits1 = arg1_prec - arg1_dec_prec;
11755 integral_digits2 = arg2_prec - arg2_dec_prec;
11886 if (arg2_dec_prec > 0)
11888 scaleup = (
MAX (arg1_dec_prec, arg2_dec_prec) + arg2_dec_prec - arg1_dec_prec);
11897 int org_prec, org_scale, new_prec, new_scale;
11903 new_scale = org_scale + scale_delta;
11904 new_prec = org_prec + scale_delta;
11965 int integral_digits1, integral_digits2;
11967 integral_digits1 = arg1_prec - arg1_dec_prec;
11968 integral_digits2 = arg2_prec - arg2_dec_prec;
11973 else if ((arg1->
type_enum != arg2->
type_enum) && pt_is_op_with_forced_common_type (op))
11983 if (arg1 && arg1->
type_enum == common_type)
12036 do_detect_collation =
false;
12062 do_detect_collation =
false;
12090 do_detect_collation =
false;
12136 do_detect_collation =
false;
12160 do_detect_collation =
false;
12168 do_detect_collation =
false;
12246 int prec = 0,
scale = 0;
12268 do_detect_collation =
false;
12288 switch (common_type)
12375 node->data_type = dt;
12376 node->data_type->type_enum = common_type;
12564 else if (arg2->
type_enum == common_type)
12568 else if (arg3->
type_enum == common_type)
12618 switch (
node->type_enum)
12672 if (
node->data_type->info.data_type.dec_precision
12730 switch (coerce_type)
12762 bool check_agg_single_arg =
false;
12763 bool is_agg_function =
false;
12768 arg_list =
node->info.function.arg_list;
12769 fcode =
node->info.function.function_type;
12798 node->info.function.arg_list = arg_list =
arg;
12814 check_agg_single_arg =
true;
12831 if (arg_list ==
NULL)
12836 node->info.function.arg_list = arg_list;
12850 if (arg_list ==
NULL)
12855 node->info.function.arg_list = arg_list;
12868 if (arg_list ==
NULL)
12872 arg_type = cast_type;
12873 node->info.function.arg_list = arg_list;
12900 check_agg_single_arg =
false;
12954 check_agg_single_arg =
false;
12963 if (arg_list ==
NULL)
12969 node->info.function.arg_list = arg_list;
12976 bool is_supported =
false;
12979 unsigned int index = 0;
12983 if (index % 2 == 0)
12994 unsupported_type =
arg->type_enum;
13018 bool is_supported =
false;
13028 unsupported_type =
arg->type_enum;
13060 unsupported_type =
arg->type_enum;
13085 unsigned int index = 0;
13086 bool is_supported =
false;
13101 if (index % 2 == 0)
13112 unsupported_type =
arg->type_enum;
13131 bool is_supported =
false;
13151 unsupported_type =
arg->type_enum;
13170 bool is_supported =
false;
13187 unsigned int index = 0;
13188 bool is_supported =
false;
13208 unsupported_type =
arg->type_enum;
13234 size_t num_bad = 0;
13236 memset (has_arg_type, 0,
sizeof (has_arg_type));
13272 while (
i < (
sizeof (has_arg_type) /
sizeof (has_arg_type[0])))
13274 if (has_arg_type[
i])
13294 if (num_bad ==
sizeof (bad_types) /
sizeof (bad_types[0]))
13306 if ((num_bad <
sizeof (bad_types) /
sizeof (bad_types[0]) - 1)
13437 check_agg_single_arg =
false;
13441 if (is_agg_function && check_agg_single_arg)
13443 if (arg_list->
next)
13456 all_or_distinct =
node->info.function.all_or_distinct;
13461 arg_list =
node->info.function.arg_list =
NULL;
13527 node->type_enum = arg_type;
13542 node->type_enum = arg_type;
13609 PT_TYPE_ENUM arg1_orig_type, arg2_orig_type, arg3_orig_type, arg4_orig_type;
13624 arg1_orig_type = arg1_type = arg_array[0]->
type_enum;
13625 arg2_orig_type = arg2_type = arg_array[1]->
type_enum;
13626 arg3_orig_type = arg3_type = arg_array[2]->
type_enum;
13627 arg4_orig_type = arg4_type = arg_array[3]->
type_enum;
13646 if (new_att ==
NULL)
13650 node->info.function.arg_list = arg_array[0] = new_att;
13651 arg_type = arg1_type = upgraded_type;
13655 arg_type = arg1_type;
13663 if (new_att ==
NULL)
13667 arg_array[0]->
next = arg_array[1] = new_att;
13676 if (new_att ==
NULL)
13680 arg_array[1]->
next = arg_array[2] = new_att;
13707 if (new_att ==
NULL)
13711 arg_array[2]->
next = arg_array[3] = new_att;
13756 PT_NODE *
arg = arg_list, *prev_arg = arg_list;
13757 int max_precision = 0;
13766 prev_arg = arg_list =
arg = new_att;
13767 node->info.function.arg_list = arg_list;
13814 precision = pt_character_length_for_node (
arg, arg_type);
13830 if (
arg->type_enum != arg_type ||
arg->data_type->info.data_type.precision != max_precision)
13833 max_precision, 0,
NULL);
13837 prev_arg->next =
arg = new_attr;
13846 prev_arg = prev_arg->next;
13853 if (
node->data_type)
13855 node->type_enum = arg_type;
13856 node->data_type->info.data_type.precision = max_precision;
13857 node->data_type->info.data_type.dec_precision = 0;
13864 node->type_enum = arg_type;
13871 arg_list =
node->info.function.arg_list;
13891 if (new_node ==
NULL)
13893 goto error_collation;
13896 arg_list->
next = new_node;
13905 if (new_node ==
NULL)
13907 goto error_collation;
13929 int args_w_coll = 0;
13963 common_coll = coll_infer1.
coll_id;
13964 common_cs = coll_infer1.
codeset;
13977 common_coll = coll_infer4.
coll_id;
13978 common_cs = coll_infer4.
codeset;
13985 common_coll = coll_infer1.
coll_id;
13986 common_cs = coll_infer1.
codeset;
13993 goto error_collation;
13998 if ((common_coll != coll_infer1.
coll_id || common_cs != coll_infer1.
codeset)
14002 pt_coerce_node_collation (
parser, arg_array[0], common_coll, common_cs, coll_infer1.
can_force_cs,
false,
14004 if (new_node ==
NULL)
14006 goto error_collation;
14009 node->info.function.arg_list = arg_array[0] = new_node;
14013 if ((common_coll != coll_infer4.
coll_id || common_cs != coll_infer4.
codeset)
14017 pt_coerce_node_collation (
parser, arg_array[3], common_coll, common_cs, coll_infer4.
can_force_cs,
false,
14019 if (new_node ==
NULL)
14021 goto error_collation;
14024 arg_array[2]->
next = arg_array[3] = new_node;
14036 if (new_node ==
NULL)
14038 goto error_collation;
14072 const char *
name = (
const char *) 0;
14077 method_name =
node->info.method_call.method_name;
14078 on_call_target =
node->info.method_call.on_call_target;
14079 if (on_call_target ==
NULL)
14116 if (method ==
NULL)
14176 PT_NODE *between_ge_lt, *between_ge_lt_arg1, *between_ge_lt_arg2;
14181 if (!arg1 || !result)
14273 for (
i = 0;
i < 2;
i++)
14317 for (
i = 0;
i < 2;
i++)
14361 for (
i = 0;
i < 2;
i++)
14406 for (
i = 0;
i < 2;
i++)
14433 if (bi[1] < (
int) (
sizeof (
DB_BIGINT) * 8) && bi[1] >= 0)
14465 for (
i = 0;
i < 2;
i++)
14586 TP_DOMAIN tmp_arg1_domain, tmp_arg2_domain;
14595 target_domain = domain;
14629 TP_DOMAIN *arg1_domain, *arg2_domain, *arg3_domain;
14630 TP_DOMAIN tmp_arg1_domain, tmp_arg2_domain, tmp_arg3_domain;
14641 target_domain = domain;
14800 _true = (op ==
PT_IS) ? 1 : 0;
14801 _false = 1 - _true;
14855 bool check_empty_string;
14977 if (o3 && o3->
next)
15192 DB_VALUE tmp_len, tmp_arg2, tmp_arg3;
15400 bool check_empty_string;
15467 if (!pt_union_sets (
parser, domain, arg1, arg2, result, o2))
15516 short s1, s2, stmp;
15582 int hour, minute, second;
15618 result_time =
time - uother;
15622 result_time = (itmp +
time) % 86400;
15654 goto error_zerodate;
15692 result_utime = (
DB_UTIME) ((*utime) + bi);
15696 result_utime = (
DB_UTIME) (*utime + bi);
15741 goto error_zerodate;
15779 result_utime = (
DB_UTIME) (utime + bi);
15783 result_utime = (
DB_UTIME) (utime + bi);
15820 if (datetime->
date == 0 && datetime->
time == 0)
15827 goto error_zerodate;
15853 result_bi = bi1 + bi2;
15861 result_bi = bi1 + bi2;
15873 result_datetime.
date = (
int) tmp_bi;
15907 if (datetime.
date == 0 && datetime.
time == 0)
15914 goto error_zerodate;
15940 result_bi = bi1 + bi2;
15948 result_bi = bi1 + bi2;
15997 goto error_zerodate;
16031 result_date = (
DB_DATE) ((*date) + bi);
16035 result_date = (
DB_DATE) (*date + bi);
16055 if (!pt_difference_sets (
parser, domain, arg1, arg2, result, o2))
16168 goto error_zerodate;
16173 result_bi = bi1 - bi2;
16187 short s1, s2, stmp;
16252 int hour, minute, second;
16270 ubi = (bi < 0) ? -bi : bi;
16280 result_time =
time - (bi % 86400);
16329 goto error_zerodate;
16337 result_utime = (
DB_UTIME) (utime - bi);
16345 result_utime = (
DB_UTIME) (utime - bi);
16406 if (datetime.
date == 0 && datetime.
time == 0)
16413 goto error_zerodate;
16448 int month, day, year;
16475 goto error_zerodate;
16483 result_date = (
DB_DATE) (*date - bi);
16491 result_date = *date - (
DB_DATE) bi;
16514 if (!pt_product_sets (
parser, domain, arg1, arg2, result, o2))
16525 volatile int i1, i2, itmp;
16567 volatile short s1, s2, stmp;
16775 bool check_empty_string;
16858 gettimeofday (&t,
NULL);
16859 srand48 ((
long) (t.tv_usec + lrand48 ()));
16872 gettimeofday (&t,
NULL);
16873 srand48 ((
long) (t.tv_usec + lrand48 ()));
17257 DB_VALUE tmp_len, tmp_arg2, tmp_arg3;
18110 int year, month, day, hour, minute, second;
18121 TZ_REGION system_tz_region, session_tz_region;
18123 int err_status = 0;
18160 tmp_time = tmp_datetime->
time / 1000;
18171 const char *t_source, *t_dest;
18172 int err_status = 0, len_source, len_dest;
18180 tmp_time = tmp_datetime->
time / 1000;
18202 tmp_date = tmp_datetime->
date;
18203 tmp_time = tmp_datetime->
time / 1000;
18221 tmp_date = tmp_datetime->
date;
18222 tmp_time = tmp_datetime->
time / 1000;
18244 TZ_REGION system_tz_region, session_tz_region;
18268 error = db_make_string_by_const_str (result, username);
18673 cmp = (cmp_result ==
DB_UNK) ? -1 : (cmp_result ==
DB_EQ) ? 1 : 0;
18680 cmp = (cmp_result ==
DB_UNK) ? -1 : (cmp_result ==
DB_EQ) ? 1 : 0;
18686 cmp = (cmp_result ==
DB_UNK) ? -1 : (cmp_result !=
DB_EQ) ? 1 : 0;
18696 if (arg2 ==
NULL || arg2->domain.general_info.is_null)
18698 cmp_result =
DB_EQ;
18702 cmp_result =
DB_NE;
18707 if (arg2 ==
NULL || arg2->domain.general_info.is_null)
18709 cmp_result =
DB_NE;
18716 cmp = (cmp_result ==
DB_EQ) ? 1 : 0;
18741 cmp = (cmp_result ==
DB_UNK) ? -1 : (cmp_result ==
DB_EQ || cmp_result ==
DB_GT) ? 1 : 0;
18746 cmp = (cmp_result ==
DB_UNK) ? -1 : (cmp_result ==
DB_GT) ? 1 : 0;
18751 cmp = (cmp_result ==
DB_UNK) ? -1 : (cmp_result ==
DB_EQ || cmp_result ==
DB_LT) ? 1 : 0;
18756 cmp = (cmp_result ==
DB_UNK) ? -1 : (cmp_result ==
DB_LT) ? 1 : 0;
18826 char const *slash_str =
"\\";
18834 esc_char = &slash_char;
18899 if (((cmp_result ==
DB_UNK) && (cmp_result2 ==
DB_UNK))
18900 || ((cmp_result ==
DB_UNK) && ((cmp_result2 ==
DB_LT) || (cmp_result2 ==
DB_EQ)))
18901 || ((cmp_result2 ==
DB_UNK) && ((cmp_result ==
DB_LT) || (cmp_result ==
DB_EQ))))
18905 else if (((cmp_result !=
DB_UNK) && (!((cmp_result ==
DB_LT) || (cmp_result ==
DB_EQ))))
18906 || ((cmp_result2 !=
DB_UNK) && (!((cmp_result2 ==
DB_LT) || (cmp_result2 ==
DB_EQ)))))
18920 if (((cmp_result ==
DB_UNK) && (cmp_result2 ==
DB_UNK))
18921 || ((cmp_result ==
DB_UNK) && ((cmp_result2 ==
DB_LT) || (cmp_result2 ==
DB_EQ)))
18922 || ((cmp_result2 ==
DB_UNK) && ((cmp_result ==
DB_LT) || (cmp_result ==
DB_EQ))))
18926 else if (((cmp_result !=
DB_UNK) && (!((cmp_result ==
DB_LT) || (cmp_result ==
DB_EQ))))
18927 || ((cmp_result2 !=
DB_UNK) && (!((cmp_result2 ==
DB_LT) || (cmp_result2 ==
DB_EQ)))))
18980 if (enum_domain ==
NULL)
19054 if (width_bucket_arg2 ==
NULL)
19060 if (width_bucket_arg3 ==
NULL)
19123 int timezone_milis;
19128 timezone_milis =
db_get_int (&timezone) * 60000;
19190 int year, month, day, hour, minute, second;
19217 const char *table_name =
NULL;
19274 DB_VALUE dummy, dbval_res, *arg1, *arg2, *arg3;
19279 const char *alias_print;
19280 unsigned is_hidden_column;
19285 bool has_error =
false;
19286 bool was_error_set =
false;
19310 expr_next = expr->
next;
19326 result->info.value.location = location;
19327 result->is_hidden_column = is_hidden_column;
19328 if (result->info.value.text ==
NULL)
19386 if (opd3 && opd3->node_type ==
PT_VALUE)
19455 bool needs_update_precision =
false;
19477 if (default_value_date_type ==
NULL 19480 needs_update_precision =
true;
19500 if (cast_expr ==
NULL)
19542 result = cast_expr;
19553 if (tmp_value ==
NULL)
19574 result = tmp_value;
19605 if (opd2 && opd2->node_type ==
PT_VALUE)
19608 type2 = opd2->type_enum;
19642 const char *attr_name;
19644 int attrid, shared;
19676 if (entity ==
NULL)
19686 PT_ERRORf (
parser, expr,
"Attribute of derived class " "is not permitted in %s()",
19687 (op ==
PT_INCR ?
"INCR" :
"DECR"));
19689 was_error_set =
true;
19696 opd2->data_type = dtype;
19701 if (opd2->info.name.resolved ==
NULL)
19721 if (opd2->node_type ==
PT_DOT_)
19739 was_error_set =
true;
19758 opd3->info.value.data_value.i = attrid;
19784 if (result ==
NULL)
19794 if (result ==
NULL)
19816 if (opd3 && opd3->node_type ==
PT_VALUE)
19819 type3 = opd3->type_enum;
19870 if (result ==
NULL)
19997 if (result ==
NULL)
20006 && (!opd2 || opd2->node_type ==
PT_VALUE) && (!opd3 || opd3->node_type ==
PT_VALUE))
20041 if (result != expr)
20048 was_error_set =
true;
20052 if (!pt_check_const_fold_op_w_args (op, arg1, arg2, arg3, domain))
20057 if (
pt_evaluate_db_value_expr (
parser, expr, op, arg1, arg2, arg3, &dbval_res, domain, opd1, opd2, opd3,
20066 if (result && expr->
or_next && result != expr)
20081 result->or_next =
NULL;
20089 if (result ==
NULL)
20103 result = pt_compare_bounds_to_value (
parser, expr, op, opd1->
type_enum, arg2, type2);
20106 if (result && expr->
or_next && result != expr)
20121 result->or_next =
NULL;
20146 rvalue = opd2->info.value.data_value.i;
20150 rvalue = opd2->info.value.data_value.bigint;
20158 if ((op ==
PT_GT && rvalue <= 0) || (op ==
PT_GE && rvalue <= 1))
20167 if (result ==
NULL)
20179 if (!was_error_set)
20184 expr->
next = expr_next;
20191 result->column_number =
column;
20192 result->alias_print = alias_print;
20193 result->is_hidden_column = is_hidden_column;
20196 if (result != expr)
20204 if (alias_print ==
NULL)
20218 result->info.value.is_collate_allowed =
true;
20223 result->next = expr_next;
20230 if (result->node_type ==
PT_EXPR)
20232 result->info.expr.location = location;
20234 else if (result->node_type ==
PT_VALUE)
20236 result->info.value.location = location;
20243 expr->
next = expr_next;
20268 if (!
args || !result)
20274 for (
i = 0;
i < num_args;
i++)
20399 const char *alias_print =
NULL;
20431 func_next = func->
next;
20445 if (result != func)
20470 result->
next = func_next;
20511 bool all_args_const =
false;
20541 operand = operand->
next;
20546 if (arg_array ==
NULL)
20553 all_args_const =
true;
20555 for (
i = 0;
i < num_args;
i++)
20564 all_args_const =
false;
20569 arg_array[
i] =
arg;
20575 arg_array[
i] = &dummy;
20576 all_args_const =
false;
20579 operand = operand->
next;
20582 if (all_args_const &&
i == num_args)
20608 if (arg_array !=
NULL)
20668 static const char *
20672 ||
type->info.data_type.entity->node_type !=
PT_NAME)
20678 return type->info.data_type.entity->info.name.original;
20780 return pt_coerce_value_internal (
parser, src,
dest, desired_type, data_type,
false,
true);
20797 bool implicit_coercion;
20802 && pt_is_explicit_coerce_allowed_for_default_value (
parser, src->
type_enum, desired_type))
20804 implicit_coercion =
false;
20808 implicit_coercion =
true;
20811 return pt_coerce_value_internal (
parser, src,
dest, desired_type, data_type,
true, implicit_coercion);
20827 PT_NODE * data_type,
bool check_string_precision,
bool implicit_coercion)
20833 bool is_collation_change =
false;
20834 bool has_type_string;
20837 bool need_src_clear =
false;
20841 dest_next =
dest->next;
20848 is_collation_change =
true;
20852 is_same_type = (original_type == desired_type && !is_collation_change);
20855 && (has_type_string ==
false || check_string_precision ==
false))
20861 dest->next = dest_next;
20867 && (
err = pt_set_default_data_type (
parser, desired_type, &data_type) < 0))
20883 dest->next = dest_next;
20894 dest->next = dest_next;
20896 dest->type_enum = desired_type;
20908 if (
parser->set_host_var == 0)
20910 dest->type_enum = desired_type;
20936 if (desired_domain !=
NULL)
20946 err =
tp_value_cast (db_src, &db_dest, desired_domain, implicit_coercion);
20982 need_src_clear =
true;
21003 if (data_type !=
NULL)
21011 dest->next = dest_next;
21026 switch (desired_type)
21029 dest->info.function.function_type =
F_SET;
21047 switch (desired_type)
21089 if (need_src_clear)
21097 #if defined(ENABLE_UNUSED_FUNCTION) 21105 generic_func_casecmp (
const void *
a,
const void *
b)
21108 ((
const GENERIC_FUNCTION_RECORD *)
b)->function_name);
21117 init_generic_funcs (
void)
21119 qsort (pt_Generic_functions, (
sizeof (pt_Generic_functions) /
sizeof (GENERIC_FUNCTION_RECORD)),
21120 sizeof (GENERIC_FUNCTION_RECORD), &generic_func_casecmp);
21121 pt_Generic_functions_sorted = 1;
21136 #if !defined(ENABLE_UNUSED_FUNCTION) 21140 GENERIC_FUNCTION_RECORD *record_p, key;
21143 if (!pt_Generic_functions_sorted)
21145 init_generic_funcs ();
21149 || !
node->info.function.generic_name)
21155 key.function_name =
node->info.function.generic_name;
21157 (GENERIC_FUNCTION_RECORD *) bsearch (&key, pt_Generic_functions,
21158 (
sizeof (pt_Generic_functions) /
sizeof (GENERIC_FUNCTION_RECORD)),
21159 sizeof (GENERIC_FUNCTION_RECORD), &generic_func_casecmp);
21172 offset->info.value.data_value.i = record_p->func_ptr_offset;
21176 pt_string_to_data_type (
parser, record_p->return_type,
node);
21203 bool lhs_less =
false;
21204 bool lhs_greater =
false;
21205 bool always_false =
false;
21206 bool always_false_due_to_null =
false;
21207 bool always_true =
false;
21212 if (lhs_type == rhs_type)
21223 always_false_due_to_null =
true;
21245 lhs_greater =
true;
21251 lhs_greater =
true;
21257 lhs_greater =
true;
21264 lhs_greater =
true;
21272 lhs_greater =
true;
21280 lhs_greater =
true;
21295 lhs_greater =
true;
21301 lhs_greater =
true;
21308 lhs_greater =
true;
21316 lhs_greater =
true;
21324 lhs_greater =
true;
21338 lhs_greater =
true;
21344 lhs_greater =
true;
21351 lhs_greater =
true;
21358 lhs_greater =
true;
21372 lhs_greater =
true;
21377 if (dtmp > FLT_MAX)
21379 else if (dtmp < -(FLT_MAX))
21380 lhs_greater =
true;
21385 if (dtmp > FLT_MAX)
21387 else if (dtmp < -(FLT_MAX))
21388 lhs_greater =
true;
21404 always_false =
true;
21408 always_true =
true;
21411 else if (lhs_greater)
21415 always_false =
true;
21419 always_true =
true;
21427 if (result ==
NULL)
21438 else if (always_false_due_to_null)
21441 if (result ==
NULL)
21451 else if (always_true)
21454 if (result ==
NULL)
21684 if (left == pt_Compare_between_operator_table[
i].left && right == pt_Compare_between_operator_table[
i].right)
21686 *between = pt_Compare_between_operator_table[
i].
between;
21718 if (between == pt_Compare_between_operator_table[
i].between)
21720 *left = pt_Compare_between_operator_table[
i].
left;
21721 *right = pt_Compare_between_operator_table[
i].
right;
21749 return pt_get_equivalent_type (def_type, arg_type);
21841 if (new_expr !=
NULL)
21865 pt_is_op_with_forced_common_type (
PT_OP_TYPE op)
21902 const int MAX_RESULT_SIZE_ON_CONST_FOLDING = 256;
21916 if (count_i > MAX_RESULT_SIZE_ON_CONST_FOLDING)
21924 if (count_sh > MAX_RESULT_SIZE_ON_CONST_FOLDING)
21932 if (count_b > MAX_RESULT_SIZE_ON_CONST_FOLDING)
21947 if (arg1_len * count_i > MAX_RESULT_SIZE_ON_CONST_FOLDING)
21965 if (arg3_len * count_i > MAX_RESULT_SIZE_ON_CONST_FOLDING)
22088 bool has_collation =
false;
22102 coll_infer->
coll_id =
node->data_type->info.data_type.collation_id;
22104 has_collation =
true;
22112 else if (
node->expected_domain !=
NULL)
22118 has_collation =
true;
22130 has_collation =
true;
22150 else if (
node->expected_domain !=
NULL)
22157 return has_collation;
22160 switch (
node->node_type)
22272 return has_collation;
22292 bool has_collation =
false;
22293 bool is_collection_of_collection =
false;
22294 bool first_element =
true;
22295 int status_inner_collection;
22327 current_set_node =
node->info.function.arg_list->info.query.q.select.list;
22328 is_collection_of_collection =
true;
22333 current_set_node =
node->info.function.arg_list;
22334 is_collection_of_collection =
true;
22339 current_set_node =
node->info.value.data_value.set;
22340 is_collection_of_collection =
true;
22343 if (is_collection_of_collection)
22346 while (current_set_node !=
NULL)
22348 status_inner_collection =
22349 pt_get_collation_of_collection (
parser, current_set_node, coll_infer,
true, &first_element);
22353 has_collation =
true;
22359 current_set_node = current_set_node->
next;
22364 status_inner_collection =
22365 pt_get_collation_of_collection (
parser, current_set_node->
data_type, coll_infer,
false, &first_element);
22369 has_collation =
true;
22383 has_collation =
true;
22397 if (!has_collation)
22416 switch (
node->node_type)
22477 assert (!has_collation);
22509 const bool is_inner_collection,
bool * is_first_element)
22512 bool has_collation =
false;
22517 if (is_inner_collection)
22519 current_node =
node->data_type;
22523 current_node =
node;
22526 if (current_node !=
NULL)
22533 status = pt_get_collation_info_for_collection_type (
parser,
node, &coll_infer_elem);
22537 has_collation =
true;
22544 if (*is_first_element)
22548 *is_first_element =
false;
22561 has_collation =
true;
22562 if (*is_first_element)
22566 *is_first_element =
false;
22608 const INTL_CODESET codeset,
bool force_mode,
bool use_collate_modifier,
22612 bool is_collection_of_collection =
false;
22624 current_set_node =
node->info.function.arg_list->info.query.q.select.list;
22625 is_collection_of_collection =
true;
22630 current_set_node =
node->info.function.arg_list;
22631 is_collection_of_collection =
true;
22636 current_set_node =
node->info.value.data_value.set;
22637 is_collection_of_collection =
true;
22640 if (is_collection_of_collection ==
true)
22644 while (current_set_node !=
NULL)
22646 save_next = current_set_node->
next;
22649 pt_coerce_node_collation (
parser, current_set_node, coll_id, codeset, force_mode, use_collate_modifier,
22650 wrap_type_for_maybe, wrap_type_collection);
22652 if (current_set_node !=
NULL)
22654 if (prev_node ==
NULL)
22663 node->info.function.arg_list->info.query.q.select.list = current_set_node;
22665 else if ((
node->info.function.function_type ==
F_SET)
22669 node->info.function.arg_list = current_set_node;
22674 node->info.value.data_value.set = current_set_node;
22680 prev_node->next = current_set_node;
22683 current_set_node->
next = save_next;
22688 goto cannot_coerce;
22690 prev_node = current_set_node;
22691 current_set_node = current_set_node->
next;
22696 node->info.value.db_value_is_initialized = 0;
22751 bool force_mode,
bool use_collate_modifier,
PT_TYPE_ENUM wrap_type_for_maybe,
22757 bool preset_hv_in_collection =
false;
22758 bool is_string_literal =
false;
22765 pt_coerce_node_collection_of_collection (
parser,
node, coll_id, codeset, force_mode, use_collate_modifier,
22766 wrap_type_for_maybe, wrap_type_collection);
22767 if (collection_node !=
node)
22769 return collection_node;
22772 original_node_type =
node->node_type;
22773 switch (
node->node_type)
22781 if (wrap_dt ==
NULL)
22783 goto cannot_coerce;
22788 wrap_dt->
type_enum = wrap_type_for_maybe;
22793 force_mode =
false;
22797 goto cannot_coerce;
22810 goto cannot_coerce;
22818 if (wrap_dt ==
NULL)
22820 goto cannot_coerce;
22825 wrap_dt->
type_enum = wrap_type_for_maybe;
22830 force_mode =
false;
22840 goto cannot_coerce;
22843 node->data_type->type_enum =
node->type_enum;
22873 goto cannot_coerce;
22877 &&
node->info.value.is_collate_allowed ==
false)
22879 is_string_literal =
true;
22891 bool apply_wrap_cast =
false;
22897 node->data_type = wrap_dt;
22899 preset_hv_in_collection =
true;
22903 dt_node =
node->data_type;
22912 apply_wrap_cast =
true;
22916 dt_node = dt_node->
next;
22918 while (dt_node !=
NULL);
22924 arg =
node->info.function.arg_list;
22928 && (
arg->data_type->info.data_type.collation_id != coll_id))
22931 apply_wrap_cast =
true;
22941 if (apply_wrap_cast)
22948 dt_node =
node->data_type;
22968 dt_node = dt_node->
next;
22970 while (dt_node !=
NULL);
22972 if (apply_wrap_cast)
22978 else if (dt !=
NULL)
22990 && ((is_string_literal ==
false &&
node->data_type->info.data_type.collation_id != coll_id)
22991 ||
node->data_type->info.data_type.units != codeset)) || wrap_dt !=
NULL)
22995 if (wrap_dt ==
NULL)
23011 if (
node->info.value.data_value.str !=
NULL)
23015 else if (
node->info.value.db_value_is_initialized)
23025 int nb_select_list;
23029 select_list =
node->info.query.q.select.list;
23037 PT_NODE *union_arg2 =
node->info.query.q.union_.arg2;
23043 if (nb_select_list != 1)
23045 goto cannot_coerce;
23052 goto cannot_coerce;
23059 bool cast_should_fold =
false;
23063 if (is_string_literal ==
false &&
node->data_type
23064 && codeset ==
node->data_type->info.data_type.units)
23067 use_collate_modifier =
true;
23071 cast_should_fold =
true;
23077 if (
node !=
NULL && use_collate_modifier)
23084 if (
node !=
NULL && cast_should_fold)
23096 node->data_type->info.data_type.collation_id = coll_id;
23097 node->data_type->info.data_type.units = (
int) codeset;
23110 goto cannot_coerce;
23115 if (
node->expected_domain->is_cached)
23119 new_domain->
codeset = (
unsigned char) codeset;
23136 node->expected_domain = new_domain;
23141 node->expected_domain->codeset = (
unsigned char) codeset;
23142 node->expected_domain->collation_id = coll_id;
23167 curr_set_dom =
node->expected_domain;
23174 while (elem_dom !=
NULL)
23177 save_elem_dom_next = elem_dom->
next;
23180 elem_dom->
next = save_elem_dom_next;
23186 new_elem_dom->
codeset = codeset;
23190 elem_dom = elem_dom->
next;
23205 switch (
node->node_type)
23208 if (
node->info.value.db_value_is_initialized &&
node->data_type !=
NULL)
23234 if (
node->expected_domain !=
NULL)
23241 node->data_type->info.data_type.collation_id = coll_id;
23242 node->data_type->info.data_type.units = (
int) codeset;
23247 if (preset_hv_in_collection)
23255 arg =
node->info.function.arg_list;
23264 if (
arg->expected_domain !=
NULL)
23273 if (
arg->expected_domain->is_cached)
23280 dom_hv =
arg->expected_domain;
23283 dom_hv->
codeset = (
unsigned char) codeset;
23316 node->info.value.is_collate_allowed =
false;
23317 node->info.value.print_charset =
true;
23353 dt_node = dt_node->
next;
23355 while (dt_node !=
NULL);
23365 assert (
node->data_type->info.data_type.collation_id == coll_id);
23400 const int args_w_coll,
bool op_has_3_args,
int *common_coll,
INTL_CODESET * common_cs)
23402 #define MORE_COERCIBLE(arg1_coll_infer, arg2_coll_infer) \ 23403 ((((arg1_coll_infer)->can_force_cs) && !((arg2_coll_infer)->can_force_cs)) \ 23404 || ((arg1_coll_infer)->coerc_level > (arg2_coll_infer)->coerc_level \ 23405 && (arg1_coll_infer)->can_force_cs == (arg2_coll_infer)->can_force_cs)) 23430 *common_coll = arg2_coll_infer->
coll_id;
23431 *common_cs = arg2_coll_infer->
codeset;
23434 if (op_has_3_args && arg3_coll_infer->
coll_id != *common_coll)
23436 bool set_arg3 =
false;
23465 *common_coll = arg3_coll_infer->
coll_id;
23466 *common_cs = arg3_coll_infer->
codeset;
23493 *common_coll = arg1_coll_infer->
coll_id;
23494 *common_cs = arg1_coll_infer->
codeset;
23497 if (op_has_3_args && arg3_coll_infer->
coll_id != *common_coll)
23499 bool set_arg3 =
false;
23528 *common_coll = arg3_coll_infer->
coll_id;
23529 *common_cs = arg3_coll_infer->
codeset;
23552 #undef MORE_COERCIBLE 23578 int args_w_coll_maybe = 0;
23579 int args_having_coll = 0;
23580 bool op_has_3_args;
23581 bool reverse_arg2_arg3;
23582 int expr_coll_modifier = -1;
23584 bool use_cast_collate_modifier =
false;
23585 bool arg1_need_coerce =
false;
23586 bool arg2_need_coerce =
false;
23587 bool arg3_need_coerce =
false;
23610 if (expr_coll_modifier != -1)
23615 expr_cs_modifier = lc->
codeset;
23618 pt_fix_arguments_collation_flag (expr);
23622 if (expr_coll_modifier != -1)
23629 goto coerce_result;
23639 if (reverse_arg2_arg3)
23681 args_w_coll_maybe++;
23686 args_having_coll++;
23687 common_coll = arg1_coll_inf.
coll_id;
23688 common_cs = arg1_coll_inf.
codeset;
23692 arg1_need_coerce =
true;
23698 int status = pt_get_collation_info_for_collection_type (
parser, arg1,
23707 args_w_coll_maybe++;
23710 args_having_coll++;
23711 common_coll = arg1_coll_inf.
coll_id;
23712 common_cs = arg1_coll_inf.
codeset;
23716 arg1_need_coerce =
true;
23727 args_w_coll_maybe++;
23732 args_having_coll++;
23733 common_coll = arg2_coll_inf.
coll_id;
23734 common_cs = arg2_coll_inf.
codeset;
23738 arg2_need_coerce =
true;
23744 int status = pt_get_collation_info_for_collection_type (
parser, arg2,
23753 args_w_coll_maybe++;
23756 args_having_coll++;
23757 common_coll = arg2_coll_inf.
coll_id;
23758 common_cs = arg2_coll_inf.
codeset;
23762 arg2_need_coerce =
true;
23773 args_w_coll_maybe++;
23778 args_having_coll++;
23779 common_coll = arg3_coll_inf.
coll_id;
23780 common_cs = arg3_coll_inf.
codeset;
23784 arg3_need_coerce =
true;
23789 int status = pt_get_collation_info_for_collection_type (
parser, arg3,
23798 args_w_coll_maybe++;
23801 args_having_coll++;
23802 common_coll = arg3_coll_inf.
coll_id;
23803 common_cs = arg3_coll_inf.
codeset;
23809 if (expr_coll_modifier != -1 &&
pt_is_comp_op (op) && args_w_coll_maybe > 0)
23831 common_cs = expr_cs_modifier;
23832 common_coll = expr_coll_modifier;
23833 use_cast_collate_modifier =
true;
23837 if (args_w_coll_maybe <= 1)
23839 goto coerce_result;
23843 assert (args_w_coll_maybe >= 2);
23847 if (args_w_coll_maybe < 3)
23851 arg1_coll_inf.
coll_id = common_coll;
23852 arg1_coll_inf.
codeset = common_cs;
23858 arg2_coll_inf.
coll_id = common_coll;
23859 arg2_coll_inf.
codeset = common_cs;
23865 arg3_coll_inf.
coll_id = common_coll;
23866 arg3_coll_inf.
codeset = common_cs;
23873 && (arg1_need_coerce ==
false && arg2_need_coerce ==
false && arg3_need_coerce ==
false))
23876 goto coerce_result;
23882 && (arg1_need_coerce ==
false && arg2_need_coerce ==
false))
23885 goto coerce_result;
23891 || arg1_need_coerce ==
true || arg2_need_coerce ==
true || arg3_need_coerce ==
true);
23893 if (
pt_common_collation (&arg1_coll_inf, &arg2_coll_inf, &arg3_coll_inf, args_w_coll_maybe, op_has_3_args,
23894 &common_coll, &common_cs) != 0)
23901 if (((arg1_type ==
PT_TYPE_MAYBE || arg1_need_coerce) && args_having_coll > 0)
23906 arg1_wrap_type = pt_wrap_type_for_collation (arg1, arg2, arg3, &arg1_collection_wrap_type);
23914 pt_coerce_node_collation (
parser, arg1, common_coll, common_cs, arg1_coll_inf.
can_force_cs,
23916 arg1_collection_wrap_type);
23918 if (new_node ==
NULL)
23926 if (((arg2_type ==
PT_TYPE_MAYBE || arg2_need_coerce) && args_having_coll > 0)
23931 arg2_wrap_type = pt_wrap_type_for_collation (arg1, arg2, arg3, &arg1_collection_wrap_type);
23939 pt_coerce_node_collation (
parser, arg2, common_coll, common_cs, arg2_coll_inf.
can_force_cs,
23941 arg2_collection_wrap_type);
23943 if (new_node ==
NULL)
23948 if (reverse_arg2_arg3)
23959 && (((arg3_type ==
PT_TYPE_MAYBE || arg3_need_coerce) && args_having_coll > 0)
23964 arg3_wrap_type = pt_wrap_type_for_collation (arg1, arg2, arg3,
NULL);
23972 pt_coerce_node_collation (
parser, arg3, common_coll, common_cs, arg3_coll_inf.
can_force_cs,
23976 if (new_node ==
NULL)
23996 if (expr_cs_modifier != common_cs)
24003 common_coll = expr_coll_modifier;
24004 common_cs = expr_cs_modifier;
24022 assert (args_w_coll_maybe > 0);
24027 expr_wrap_type = arg1_type;
24031 expr_wrap_type = arg2_type;
24035 expr_wrap_type = arg3_type;
24042 expr_wrap_type = arg1_type;
24046 expr_wrap_type = arg2_type;
24053 pt_coerce_node_collation (
parser, expr, common_coll, common_cs,
true,
false,
24057 if (new_node ==
NULL)
24069 if (args_having_coll == 0)
24107 if (args_having_coll > 0)
24115 expr_wrap_type = pt_wrap_type_for_collation (arg1, arg2, arg3,
NULL);
24124 pt_coerce_node_collation (
parser, expr, common_coll, common_cs,
true,
false,
24126 if (new_node ==
NULL)
24163 int recurs_coll = -1;
24166 bool need_arg_coerc =
false;
24183 if (recurs_coll != -1 && recurs_coll != arg1_coll_infer.
coll_id 24184 && recurs_coerc_level == arg1_coll_infer.
coerc_level)
24190 if (recurs_coll != -1)
24192 need_arg_coerc =
true;
24195 if (recurs_coerc_level > arg1_coll_infer.
coerc_level || recurs_coll == -1)
24197 recurs_coerc_level = arg1_coll_infer.
coerc_level;
24198 recurs_coll = arg1_coll_infer.
coll_id;
24199 recurs_cs = arg1_coll_infer.
codeset;
24207 if (recurs_coll != -1 && recurs_coll != arg2_coll_infer.
coll_id 24208 && recurs_coerc_level == arg2_coll_infer.
coerc_level)
24214 if (recurs_coll != -1)
24216 need_arg_coerc =
true;
24219 if (recurs_coerc_level > arg2_coll_infer.
coerc_level || recurs_coll == -1)
24221 recurs_coerc_level = arg2_coll_infer.
coerc_level;
24222 recurs_coll = arg2_coll_infer.
coll_id;
24223 recurs_cs = arg2_coll_infer.
codeset;
24250 pt_coerce_node_collation (
parser, arg1, recurs_coll, recurs_cs, arg1_coll_infer.
can_force_cs,
false,
24272 pt_coerce_node_collation (
parser, arg2, recurs_coll, recurs_cs, arg2_coll_infer.
can_force_cs,
false,
24285 pt_coerce_node_collation (
parser, arg2, recurs_coll, recurs_cs,
true,
false,
24303 pt_coerce_node_collation (
parser, expr, recurs_coll, recurs_cs,
true,
false,
24384 switch (
node->node_type)
24390 PT_NODE *select_list =
node->info.query.q.select.list;
24391 for (item = select_list; item !=
NULL; prev = item, item = item->
next)
24398 new_node = pt_node_to_enumeration_expr (
parser, data_type, item);
24399 if (new_node ==
NULL)
24409 node->info.query.q.select.list = item;
24421 new_node = pt_select_list_to_enumeration_expr (
parser, data_type,
node->info.query.q.union_.arg1);
24422 if (new_node ==
NULL)
24426 node->info.query.q.union_.arg1 = new_node;
24427 new_node = pt_select_list_to_enumeration_expr (
parser, data_type,
node->info.query.q.union_.arg2);
24428 if (new_node ==
NULL)
24432 node->info.query.q.union_.arg2 = new_node;
24563 if (domain ==
NULL)
24622 switch (arg2->node_type)
24633 node->info.function.function_type =
F_SET;
24634 node->info.function.arg_list = arg2->info.value.data_value.set;
24635 node->type_enum = arg2->type_enum;
24637 arg2->info.value.data_value.set =
NULL;
24652 while (list !=
NULL)
24665 save_next = list->
next;
24674 if (list_prev ==
NULL)
24676 *list_start =
node;
24685 if (arg2->data_type !=
NULL)
24688 arg2->data_type =
NULL;
24719 PT_NODE *between, *between_ge_lt;
24723 arg1 =
node->info.expr.arg1;
24726 between =
node->info.expr.arg2;
24755 return common_type;
24794 if (between_ge_lt_arg2->node_type ==
PT_VALUE)
24844 if (wrap_type_collection !=
NULL)
24854 else if (wrap_type_collection !=
NULL)
24861 *wrap_type_collection = arg1_type;
24862 arg_collection = arg1;
24866 *wrap_type_collection = arg2_type;
24867 arg_collection = arg2;
24891 while (dom !=
NULL)
24902 return common_type;
24927 pt_fix_arguments_collation_flag (
PT_NODE * expr)
24946 if (!pt_get_expression_definition (expr->
info.
expr.
op, &def))
24964 arg1_sig_type = arg_curr_sig_type;
24978 arg2_sig_type = arg_curr_sig_type;
24993 arg3_sig_type = arg_curr_sig_type;
25013 if (
arg->info.expr.cast_type !=
NULL 25032 if (
arg->info.expr.cast_type !=
NULL 25051 if (
arg->info.expr.cast_type !=
NULL 25072 PT_NODE *arg_list, *
arg, *prev_arg, *new_node;
25074 bool need_arg_coerc =
false;
25083 if (
node->info.function.arg_list ==
NULL)
25088 fcode =
node->info.function.function_type;
25089 arg_list =
node->info.function.arg_list;
25092 if (fcode ==
F_ELT)
25098 arg_list = arg_list->
next;
25099 prev_arg = arg_list;
25104 common_coll_infer.
coll_id = -1;
25122 bool apply_common_coll =
false;
25128 need_arg_coerc =
true;
25131 if (common_coll_infer.
coll_id == -1)
25133 apply_common_coll =
true;
25140 if (common_coll != common_coll_infer.
coll_id)
25142 apply_common_coll =
true;
25147 goto error_collation;
25151 if (apply_common_coll)
25153 common_coll_infer = arg_coll_infer;
25160 if (common_coll_infer.
coll_id == -1)
25166 while (need_arg_coerc &&
arg !=
NULL)
25190 save_next =
arg->next;
25197 if (new_node !=
NULL)
25200 if (prev_arg ==
NULL)
25202 node->info.function.arg_list =
arg;
25208 arg->next = save_next;
25216 if (need_arg_coerc)
25233 node->data_type->info.data_type.collation_flag = res_collation_flag;
25241 if (new_node !=
NULL)
25275 pt_update_host_var_data_type (
parser,
node);
25279 pt_update_host_var_data_type (
parser,
p);
25328 &&
node->info.expr.arg1->data_type->info.data_type.units !=
node->info.expr.cast_type->info.data_type.units
25329 &&
node->info.expr.cast_type->info.data_type.units != codeset)
#define ER_IT_INCOMPATIBLE_DATATYPE
int julian_encode(int m, int d, int y)
DB_OBJECT * db_find_class(const char *name)
#define PT_NAME_INFO_SET_FLAG(e, f)
#define ER_REGEX_COMPILE_ERROR
int db_inet_ntoa(DB_VALUE *result_ip_string, const DB_VALUE *number)
PT_NODE * pt_name(PARSER_CONTEXT *parser_ptr, const char *name)
DB_C_FLOAT db_get_float(const DB_VALUE *value)
int db_sin_dbval(DB_VALUE *result, DB_VALUE *value)
int db_date_format(const DB_VALUE *date_value, const DB_VALUE *format, const DB_VALUE *date_lang, DB_VALUE *result, const TP_DOMAIN *domain)
int db_set_compare(const DB_VALUE *value1, const DB_VALUE *value2)
int set_difference(DB_COLLECTION *collection1, DB_COLLECTION *collection2, DB_COLLECTION **result, DB_DOMAIN *domain)
#define TP_IS_DATE_OR_TIME_TYPE(typeid)
TP_DOMAIN_STATUS tp_value_coerce(const DB_VALUE *src, DB_VALUE *dest, const TP_DOMAIN *desired_domain)
int db_time_format(const DB_VALUE *src_value, const DB_VALUE *format, const DB_VALUE *date_lang, DB_VALUE *result, const TP_DOMAIN *domain)
#define PT_HAS_TIME_PART(t)
PT_OP_TYPE pt_negate_op(PT_OP_TYPE op)
PT_NODE * pt_wrap_with_cast_op(PARSER_CONTEXT *parser, PT_NODE *arg, PT_TYPE_ENUM new_type, int p, int s, PT_NODE *desired_dt)
unsigned is_wrapped_res_for_coll
int db_make_datetime(DB_VALUE *value, const DB_DATETIME *datetime)
int db_find_string_in_in_set(const DB_VALUE *needle, const DB_VALUE *stack, DB_VALUE *result)
int pt_has_error(const PARSER_CONTEXT *parser)
MISC_OPERAND pt_misc_to_qp_misc_operand(PT_MISC_TYPE misc_specifier)
int db_get_date_weekday(const DB_VALUE *src_date, const int mode, DB_VALUE *result)
int db_get_date_quarter(const DB_VALUE *src_date, DB_VALUE *result)
int db_get_date_totaldays(const DB_VALUE *src_date, DB_VALUE *result)
#define ER_DB_UNIMPLEMENTED
#define PT_EXPR_INFO_CAST_SHOULD_FOLD
#define DB_ROW_COUNT_NOT_SET
DB_COLLECTION * db_get_set(const DB_VALUE *value)
#define DB_MAX_BIT_PRECISION
#define LANG_SYS_COLLATION
int pr_data_writeval_disk_size(DB_VALUE *value)
bool pt_is_aggregate_function(PARSER_CONTEXT *parser, const PT_NODE *node)
#define LANG_GET_BINARY_COLLATION(c)
int db_string_space(DB_VALUE const *count, DB_VALUE *result)
#define PT_COLL_WRAP_TYPE_FOR_MAYBE(type)
PT_OP_TYPE pt_converse_op(PT_OP_TYPE op)
TP_DOMAIN * tp_domain_resolve_default_w_coll(DB_TYPE type, int coll_id, TP_DOMAIN_COLL_ACTION coll_flag)
int tz_timestamptz_fix_zone(const DB_TIMESTAMPTZ *src_ts_tz, DB_TIMESTAMPTZ *dest_ts_tz)
int pt_comp_to_between_op(PT_OP_TYPE left, PT_OP_TYPE right, PT_COMP_TO_BETWEEN_OP_CODE_TYPE type, PT_OP_TYPE *between)
DB_VALUE_COMPARE_RESULT tp_value_compare(const DB_VALUE *value1, const DB_VALUE *value2, int allow_coercion, int total_order)
#define PT_IS_CHAR_STRING_TYPE(t)
TP_DOMAIN * expected_domain
#define PT_ERRORm(parser, node, setNo, msgNo)
#define MSGCAT_SEMANTIC_CANT_EXTRACT_FROM
#define MSGCAT_SEMANTIC_COLLATE_NOT_ALLOWED
#define db_locate_numeric(value)
PT_NODE * pt_where_type_keep_true(PARSER_CONTEXT *parser, PT_NODE *where)
#define MSGCAT_SEMANTIC_FUNC_NOT_DEFINED_ON_2
int pt_type_generic_func(PARSER_CONTEXT *parser, PT_NODE *node)
TP_DOMAIN * tp_domain_select(const TP_DOMAIN *domain_list, const DB_VALUE *value, int allow_coercion, TP_MATCH exact_match)
#define MSGCAT_SEMANTIC_WANT_LOGICAL_WHERE
bool pt_is_op_hv_late_bind(PT_OP_TYPE op)
#define QSTR_IS_ANY_CHAR(s)
struct pt_arg_type PT_ARG_TYPE
STATEMENT_SET_FOLD pt_check_union_is_foldable(PARSER_CONTEXT *parser, PT_NODE *union_node)
int set_issome(DB_VALUE *value, DB_COLLECTION *set, PT_OP_TYPE op, int do_coercion)
#define MSGCAT_SEMANTIC_DATA_OVERFLOW_ON
bool obt_Last_insert_id_generated
int db_bigint_to_binary_string(const DB_VALUE *src_bigint, DB_VALUE *result)
#define TP_IS_SET_TYPE(typenum)
int db_make_string(DB_VALUE *value, char *str)
int db_add_int_to_datetime(DB_DATETIME *datetime, DB_BIGINT bi2, DB_DATETIME *result_datetime)
int db_string_chr(DB_VALUE *res, DB_VALUE *dbval1, DB_VALUE *dbval2)
int db_string_index_prefix(const DB_VALUE *string1, const DB_VALUE *string2, const DB_VALUE *index_type, DB_VALUE *prefix_index)
int db_make_bigint(DB_VALUE *value, const DB_BIGINT num)
int db_get_int(const DB_VALUE *value)
int db_json_merge(DB_VALUE *result, DB_VALUE *arg[], int const num_args)
int db_json_array(DB_VALUE *result, DB_VALUE *arg[], int const num_args)
int tp_more_general_type(const DB_TYPE type1, const DB_TYPE type2)
#define DB_DEFAULT_NUMERIC_DIVISION_SCALE
int db_string_insert_substring(DB_VALUE *src_string, const DB_VALUE *position, const DB_VALUE *length, DB_VALUE *sub_string, DB_VALUE *result)
#define LANG_IS_COERCIBLE_COLL(c)
DB_C_DOUBLE db_get_double(const DB_VALUE *value)
void tz_timestamp_decode_no_leap_sec(int timestamp, int *yearp, int *monthsp, int *dayp, int *hoursp, int *minutesp, int *secondsp)
void numeric_coerce_num_to_double(DB_C_NUMERIC num, int scale, double *adouble)
int db_char_to_blob(const DB_VALUE *src_value, DB_VALUE *result_value)
#define COMPARE_BETWEEN_OPERATOR_COUNT
int db_json_remove(DB_VALUE *result, DB_VALUE *arg[], int const num_args)
PT_TYPE_ENUM recursive_type
int db_new_time(DB_VALUE *time_val, DB_VALUE *tz_source, DB_VALUE *tz_dest, DB_VALUE *result_time)
int pt_node_list_to_array(PARSER_CONTEXT *parser, PT_NODE *arg_list, PT_NODE *arg_array[], const int array_size, int *num_args)
int db_convert_sec_to_time(const DB_VALUE *src, DB_VALUE *result)
#define MSGCAT_SEMANTIC_OUT_OF_MEMORY
PT_GENERIC_TYPE_ENUM generic_type
int db_get_string_collation(const DB_VALUE *value)
#define PT_EXPR_INFO_SET_FLAG(e, f)
int numeric_db_value_div(const DB_VALUE *dbv1, const DB_VALUE *dbv2, DB_VALUE *answer)
int numeric_db_value_negate(DB_VALUE *answer)
#define MSGCAT_SEMANTIC_COLLATION_OP_ERROR
struct tp_domain * setdomain
#define PT_NODE_DATA_TYPE(n)
int db_timestamp_encode_ses(const DB_DATE *date, const DB_TIME *timeval, DB_TIMESTAMP *utime, TZ_ID *dest_tz_id)
PT_NODE * pt_get_select_list(PARSER_CONTEXT *parser, PT_NODE *query)
PT_NODE * pt_make_prim_data_type_fortonum(PARSER_CONTEXT *parser, int prec, int scale)
int db_value_clone(DB_VALUE *src, DB_VALUE *dest)
#define MSGCAT_SEMANTIC_OP_NOT_DEFINED_ON_1
#define PT_EXPR_INFO_CAST_NOFAIL
void set_make_collection(DB_VALUE *value, DB_COLLECTION *col)
PT_TYPE_ENUM pt_common_type(PT_TYPE_ENUM arg1_type, PT_TYPE_ENUM arg2_type)
#define PT_NODE_PRINT_TO_ALIAS(p, n, c)
union pt_query_info::@174 q
#define SECONDS_OF_ONE_DAY
enum pt_type_enum PT_TYPE_ENUM
int db_make_numeric(DB_VALUE *value, const DB_C_NUMERIC num, const int precision, const int scale)
unsigned is_added_by_parser
bool numeric_db_value_is_zero(const DB_VALUE *arg)
int db_power_dbval(DB_VALUE *result, DB_VALUE *value1, DB_VALUE *value2)
int db_asin_dbval(DB_VALUE *result, DB_VALUE *value)
void tz_get_session_tz_region(TZ_REGION *tz_region)
#define DB_MAX_NCHAR_PRECISION
#define ER_QSTR_INVALID_DATA_TYPE
int db_subtract_int_from_datetime(DB_DATETIME *dt1, DB_BIGINT bi2, DB_DATETIME *result_datetime)
DB_C_NUMERIC db_get_numeric(const DB_VALUE *value)
void pt_set_expected_domain(PT_NODE *node, TP_DOMAIN *domain)
DB_DOMAIN * pt_node_data_type_to_db_domain(PARSER_CONTEXT *parser, PT_NODE *dt, PT_TYPE_ENUM type)
#define OR_CHECK_SHORT_DIV_OVERFLOW(a, b)
int setobj_get_element_ptr(COL *col, int index, DB_VALUE **result)
int db_json_set(DB_VALUE *result, DB_VALUE *arg[], int const num_args)
int db_value_compare(const DB_VALUE *value1, const DB_VALUE *value2)
#define MSGCAT_SEMANTIC_CS_MATCH_COLLATE
int set_size(DB_COLLECTION *set)
PT_TYPE_ENUM pt_db_to_type_enum(const DB_TYPE t)
#define pt_is_input_parameter(n)
INTL_LANG lang_get_lang_id_from_flag(const int flag, bool *has_user_format, bool *has_user_lang)
LPOLESTR DBORDINAL flags BYTE BYTE scale
int db_string_reverse(const DB_VALUE *src_str, DB_VALUE *result_str)
#define PT_IS_LOB_TYPE(t)
bool pt_is_json_doc_type(PT_TYPE_ENUM type)
#define MSGCAT_SEMANTIC_COLLECTION_EL_COLLATION_ERROR
#define PT_ERRORmf5(parser, node, setNo, msgNo, arg1, arg2, arg3, arg4, arg5)
int db_json_get_all_paths(DB_VALUE *result, DB_VALUE *arg[], int const num_args)
#define PT_IS_DATE_TIME_TYPE(t)
const char * pt_show_function(FUNC_TYPE c)
int db_make_date(DB_VALUE *value, const int month, const int day, const int year)
bool pt_is_json_value_type(PT_TYPE_ENUM type)
#define OID_SET_NULL(oidp)
DB_DATETIMETZ * db_get_datetimetz(const DB_VALUE *value)
int db_make_datetimeltz(DB_VALUE *value, const DB_DATETIME *datetime)
#define OR_CHECK_ADD_OVERFLOW(a, b, c)
int db_exp_dbval(DB_VALUE *result, DB_VALUE *value)
int db_round_dbval(DB_VALUE *result, DB_VALUE *value1, DB_VALUE *value2)
int db_string_from_base64(DB_VALUE const *src, DB_VALUE *result)
#define TP_IS_STRING_TYPE(typeid)
#define PT_NODE_IS_SESSION_VARIABLE(node)
TP_DOMAIN * tp_domain_copy(const TP_DOMAIN *domain, bool check_cache)
#define PT_IS_NULL_NODE(e)
DB_DOMAIN * pt_node_to_db_domain(PARSER_CONTEXT *parser, PT_NODE *node, const char *class_name)
int tz_conv_tz_time_w_zone_name(const DB_TIME *time_source, const char *source_zone, int len_source, const char *dest_zone, int len_dest, DB_TIME *time_dest)
TP_DOMAIN tp_Integer_domain
int db_time_dbval(DB_VALUE *result, const DB_VALUE *datetime_value, const TP_DOMAIN *domain)
#define PT_IS_STRING_TYPE(t)
int db_from_unixtime(const DB_VALUE *src_value, const DB_VALUE *format, const DB_VALUE *date_lang, DB_VALUE *result, const TP_DOMAIN *domain)
#define PT_NAME_INFO_IS_FLAGED(e, f)
void db_string_free(char *string)
bool pt_false_where(PARSER_CONTEXT *parser, PT_NODE *node)
PT_NODE_LIST_INFO node_list
int db_string_sha_one(DB_VALUE const *src, DB_VALUE *result)
int db_to_timestamp(const DB_VALUE *src_str, const DB_VALUE *format_str, const DB_VALUE *date_lang, const DB_TYPE type, DB_VALUE *result_timestamp)
int numeric_db_value_sub(const DB_VALUE *dbv1, const DB_VALUE *dbv2, DB_VALUE *answer)
#define TP_TIMESTAMPTZ_AS_CHAR_LENGTH
#define DB_VALUE_PRECISION(value)
int tz_conv_tz_datetime_w_region(const DB_DATETIME *src_dt, const TZ_REGION *src_tz_region, const TZ_REGION *dest_tz_region, DB_DATETIME *dest_dt, TZ_ID *src_tz_id_out, TZ_ID *dest_tz_id_out)
int pt_between_to_comp_op(PT_OP_TYPE between, PT_OP_TYPE *left, PT_OP_TYPE *right)
#define MSGCAT_SEMANTIC_FUNC_NOT_DEFINED_ON_4
int db_add_time(const DB_VALUE *left, const DB_VALUE *right, DB_VALUE *result, const TP_DOMAIN *domain)
enum tp_domain_status TP_DOMAIN_STATUS
const char * pt_show_misc_type(PT_MISC_TYPE p)
int db_timestamp_encode_sys(const DB_DATE *date, const DB_TIME *timeval, DB_TIMESTAMP *utime, TZ_ID *dest_tz_id)
int db_sign_dbval(DB_VALUE *result, DB_VALUE *value)
PT_NODE * pt_where_type(PARSER_CONTEXT *parser, PT_NODE *where)
void pt_add_type_to_set(PARSER_CONTEXT *parser, const PT_NODE *typs, PT_NODE **set)
int db_json_replace(DB_VALUE *result, DB_VALUE *arg[], int const num_args)
#define MSGCAT_SEMANTIC_TIME_UNDERFLOW
int db_blob_length(const DB_VALUE *src_value, DB_VALUE *result_value)
void pt_to_regu_resolve_domain(int *p_precision, int *p_scale, const PT_NODE *node)
#define MSGCAT_SEMANTIC_IS_NOT_A
#define DB_DEFAULT_NUMERIC_SCALE
int db_atan2_dbval(DB_VALUE *result, DB_VALUE *value, DB_VALUE *value2)
int db_log_generic_dbval(DB_VALUE *result, DB_VALUE *value, long b)
#define MSGCAT_SEMANTIC_WANT_LOGICAL_CASE_COND
int db_string_substring(const MISC_OPERAND substr_operand, const DB_VALUE *src_string, const DB_VALUE *start_position, const DB_VALUE *extraction_length, DB_VALUE *sub_string)
#define DB_VALUE_SCALE(value)
int db_sleep(DB_VALUE *result, DB_VALUE *value)
#define MSGCAT_SEMANTIC_WANT_TYPE
TP_DOMAIN * pt_xasl_node_to_domain(PARSER_CONTEXT *parser, const PT_NODE *node)
bool pt_is_operator_logical(PT_OP_TYPE op)
#define TP_DOUBLE_AS_CHAR_LENGTH
#define MSGCAT_SEMANTIC_CANT_COERCE_TO
void pt_preset_hostvar(PARSER_CONTEXT *parser, PT_NODE *hv_node)
#define OR_CHECK_BIGINT_DIV_OVERFLOW(a, b)
DB_TIMESTAMPTZ * db_get_timestamptz(const DB_VALUE *value)
int db_make_short(DB_VALUE *value, const DB_C_SHORT num)
int db_check_time_date_format(const char *format_s)
int db_string_aes_decrypt(DB_VALUE const *src, DB_VALUE const *key, DB_VALUE *result)
DB_TYPE pt_type_enum_to_db(const PT_TYPE_ENUM t)
bool pt_list_has_logical_nodes(PT_NODE *list)
DB_MONETARY * db_get_monetary(const DB_VALUE *value)
#define PT_ERRORmf3(parser, node, setNo, msgNo, arg1, arg2, arg3)
int db_json_contains_dbval(const DB_VALUE *json, const DB_VALUE *value, const DB_VALUE *path, DB_VALUE *result)
int db_string_position(const DB_VALUE *sub_string, const DB_VALUE *src_string, DB_VALUE *result)
PT_MISC_TYPE derived_table_type
unsigned int DB_TIMESTAMP
int db_unix_timestamp(const DB_VALUE *src_date, DB_VALUE *result_timestamp)
#define OR_CHECK_DOUBLE_OVERFLOW(i)
#define DB_MAX_VARBIT_PRECISION
int pt_wrap_select_list_with_cast_op(PARSER_CONTEXT *parser, PT_NODE *query, PT_TYPE_ENUM new_type, int p, int s, PT_NODE *data_type, bool force_wrap)
int set_union(DB_COLLECTION *collection1, DB_COLLECTION *collection2, DB_COLLECTION **result, DB_DOMAIN *domain)
enum pt_coll_coerc_lev PT_COLL_COERC_LEV
#define PT_NODE_PRINT_VALUE_TO_TEXT(p, n)
int db_add_days_to_year(const DB_VALUE *src_year, const DB_VALUE *src_days, DB_VALUE *result)
int pt_is_between_range_op(PT_OP_TYPE op)
TP_DOMAIN * tp_domain_resolve_default(DB_TYPE type)
int db_string_concatenate(const DB_VALUE *string1, const DB_VALUE *string2, DB_VALUE *result, DB_DATA_STATUS *data_status)
void er_set(int severity, const char *file_name, const int line_no, int err_id, int num_args,...)
bool db_string_check_explicit_date(const char *str, int str_len)
int db_string_lower(const DB_VALUE *string, DB_VALUE *lower_string)
LANG_COLLATION * lang_get_collation(const int coll_id)
#define TP_TIMESTAMP_AS_CHAR_LENGTH
PT_FUNCTION_INFO function
int db_cot_dbval(DB_VALUE *result, DB_VALUE *value)
#define TP_FLOAT_AS_CHAR_LENGTH
int db_value_put_encoded_time(DB_VALUE *value, const DB_TIME *time)
#define CAST_POINTER_TO_NODE(p)
#define DB_MAX_VARCHAR_PRECISION
#define DB_MAX_NUMERIC_PRECISION
int db_make_nchar(DB_VALUE *value, const int nchar_length, const DB_C_NCHAR str, const int nchar_str_byte_size, const int codeset, const int collation_id)
int db_log_dbval(DB_VALUE *result, DB_VALUE *value1, DB_VALUE *value2)
int db_bit_count_dbval(DB_VALUE *result, DB_VALUE *value)
#define PT_ERRORmf2(parser, node, setNo, msgNo, arg1, arg2)
int db_make_monetary(DB_VALUE *value, const DB_CURRENCY type, const double amount)
int db_string_elt(DB_VALUE *result, DB_VALUE *arg[], int const num_args)
#define PT_IS_INPUT_HOSTVAR(n)
#define PT_IS_QUERY_NODE_TYPE(x)
#define LANG_COERCIBLE_CODESET
int db_json_valid_dbval(const DB_VALUE *json, DB_VALUE *type_res)
union pt_arg_type_val PT_ARG_TYPE_VAL
#define OR_CHECK_INT_DIV_OVERFLOW(a, b)
int prm_get_integer_value(PARAM_ID prm_id)
#define ER_TIME_CONVERSION
bool pt_check_cast_op(PARSER_CONTEXT *parser, PT_NODE *node)
TP_DOMAIN * tp_infer_common_domain(TP_DOMAIN *arg1, TP_DOMAIN *arg2)
char * db_get_database_name(void)
PT_TYPE_ENUM virt_type_enum
int tp_domain_status_er_set(TP_DOMAIN_STATUS status, const char *file_name, const int line_no, const DB_VALUE *src, const TP_DOMAIN *domain)
int db_json_type_dbval(const DB_VALUE *json, DB_VALUE *type_res)
struct expression_definition EXPRESSION_DEFINITION
EXPRESSION_SIGNATURE overloads[MAX_OVERLOADS]
int db_string_replace(const DB_VALUE *src_string, const DB_VALUE *srch_string, const DB_VALUE *repl_string, DB_VALUE *replaced_string)
char * db_get_user_and_host_name(void)
#define PT_SET_NODE_COLL_MODIFIER(p, coll)
#define OR_CHECK_UNS_ADD_OVERFLOW(a, b, c)
const char * pt_show_type_enum(PT_TYPE_ENUM t)
PT_NODE * pt_wrap_collection_with_cast_op(PARSER_CONTEXT *parser, PT_NODE *arg, PT_TYPE_ENUM set_type, PT_NODE *set_data, bool for_collation)
#define ER_IT_DATA_OVERFLOW
#define PT_IS_BIT_STRING_TYPE(t)
#define ER_OUT_OF_VIRTUAL_MEMORY
#define PT_GET_COLLATION_MODIFIER(p)
#define PT_DOES_FUNCTION_HAVE_DIFFERENT_ARGS(op)
#define DB_ENUM_OVERFLOW_VAL
#define PT_ARE_COMPARABLE(typ1, typ2)
LPOLESTR DBORDINAL flags dbtype
#define MSGCAT_SET_PARSER_RUNTIME
int db_format(const DB_VALUE *value, const DB_VALUE *decimals, const DB_VALUE *number_lang, DB_VALUE *result, const TP_DOMAIN *domain)
#define MORE_COERCIBLE(arg1_coll_infer, arg2_coll_infer)
#define MSGCAT_SEMANTIC_DATE_UNDERFLOW
int db_json_keys(DB_VALUE *result, DB_VALUE *arg[], int const num_args)
PT_NODE * pt_check_type_compatibility_of_values_query(PARSER_CONTEXT *parser, PT_NODE *node)
int db_time_encode(DB_TIME *timeval, int hour, int minute, int second)
PT_MISC_TYPE all_distinct
int db_string_compare(const DB_VALUE *string1, const DB_VALUE *string2, DB_VALUE *result)
int db_json_pretty_dbval(DB_VALUE *json, DB_VALUE *res)
#define MSGCAT_SEMANTIC_OVERFLOW_COERCING_TO
#define ER_ATTEMPT_TO_USE_ZERODATE
#define PT_ERRORmf4(parser, node, setNo, msgNo, arg1, arg2, arg3, arg4)
#define PT_IS_PARAMETERIZED_TYPE(t)
int db_tan_dbval(DB_VALUE *result, DB_VALUE *value)
int intl_identifier_casecmp(const char *str1, const char *str2)
int db_string_pad(const MISC_OPERAND pad_operand, const DB_VALUE *src_string, const DB_VALUE *pad_length, const DB_VALUE *pad_charset, DB_VALUE *padded_string)
#define DB_VALUE_DOMAIN_TYPE(value)
int db_to_datetime(const DB_VALUE *src_str, const DB_VALUE *format_str, const DB_VALUE *date_lang, const DB_TYPE type, DB_VALUE *result_datetime)
int db_ascii(const DB_VALUE *param, DB_VALUE *result)
DB_DOMAIN * db_method_return_domain(DB_METHOD *method)
#define PT_IS_LEFT_RECURSIVE_EXPRESSION(node)
int db_string_substring_index(DB_VALUE *src_string, DB_VALUE *delim_string, const DB_VALUE *count, DB_VALUE *result)
struct compare_between_operator COMPARE_BETWEEN_OPERATOR
int db_get_date_item(const DB_VALUE *src_date, const int item_type, DB_VALUE *result)
#define TP_DOMAIN_COLLATION(dom)
#define TP_IS_NUMERIC_TYPE(typeid)
int db_string_upper(const DB_VALUE *string, DB_VALUE *upper_string)
int db_json_length_dbval(const DB_VALUE *json, const DB_VALUE *path, DB_VALUE *res)
#define PT_IS_NATIONAL_CHAR_STRING_TYPE(t)
const char * db_error_string(int level)
#define MSGCAT_SEMANTIC_NOT_SINGLE_COL
PT_NODE * parser_copy_tree(PARSER_CONTEXT *parser, const PT_NODE *tree)
#define PT_IS_VALUE_QUERY(n)
int db_acos_dbval(DB_VALUE *result, DB_VALUE *value)
#define OR_CHECK_INT_OVERFLOW(i)
#define TP_SMALLINT_AS_CHAR_LENGTH
#define NUM_F_INSERT_SUBSTRING_ARGS
int db_date_dbval(DB_VALUE *result, const DB_VALUE *date_value, const TP_DOMAIN *domain)
DB_DOMAIN * pt_data_type_to_db_domain(PARSER_CONTEXT *parser, PT_NODE *dt, const char *class_name)
struct expression_signature EXPRESSION_SIGNATURE
const char * pt_show_binopcode(PT_OP_TYPE n)
int db_make_timestamptz(DB_VALUE *value, const DB_C_TIMESTAMPTZ *ts_tz_val)
unsigned is_alias_enabled_expr
int db_string_put_cs_and_collation(DB_VALUE *value, const int codeset, const int collation_id)
#define PT_IS_VALUE_NODE(n)
TP_DOMAIN_STATUS tp_value_cast(const DB_VALUE *src, DB_VALUE *dest, const TP_DOMAIN *desired_domain, bool implicit_coercion)
#define PT_IS_DISCRETE_NUMBER_TYPE(t)
#define TP_DOMAIN_TYPE(dom)
XML_EndCdataSectionHandler end
PT_DATA_TYPE_INFO data_type
#define TP_INTEGER_AS_CHAR_LENGTH
void db_update_row_count_cache(const int row_count)
#define PT_SET_VALUE_QUERY(n)
int db_timestamp(const DB_VALUE *src_datetime1, const DB_VALUE *src_time2, DB_VALUE *result_datetime)
#define TP_BIGINT_AS_CHAR_LENGTH
PT_NODE * pt_find_entity(PARSER_CONTEXT *parser, const PT_NODE *scope, UINTPTR id)
int db_json_array_append(DB_VALUE *result, DB_VALUE *arg[], int const num_args)
int db_str_to_date(const DB_VALUE *str, const DB_VALUE *format, const DB_VALUE *date_lang, DB_VALUE *result, TP_DOMAIN *domain)
int db_string_translate(const DB_VALUE *src_string, const DB_VALUE *from_string, const DB_VALUE *to_string, DB_VALUE *transed_string)
unsigned short db_get_enum_short(const DB_VALUE *value)
bool db_string_check_explicit_time(const char *str, int str_len)
int db_blob_to_bit(const DB_VALUE *src_value, const DB_VALUE *length_value, DB_VALUE *result_value)
const char * er_msg(void)
int db_string_instr(const DB_VALUE *src_string, const DB_VALUE *sub_string, const DB_VALUE *start_pos, DB_VALUE *result)
switch(pDBProp->dwPropertyID)
int db_date_add_interval_days(DB_VALUE *result, const DB_VALUE *date, const DB_VALUE *db_days)
#define LANG_COERCIBLE_COLL
TP_DOMAIN * tp_domain_resolve_value(DB_VALUE *val, TP_DOMAIN *dbuf)
void tz_get_system_tz_region(TZ_REGION *tz_region)
#define PT_IS_RIGHT_RECURSIVE_EXPRESSION(node)
int db_blob_from_file(const DB_VALUE *src_value, DB_VALUE *result_value)
#define MSGCAT_SEMANTIC_FUNC_NOT_DEFINED_ON
PT_NODE * pt_limit_to_numbering_expr(PARSER_CONTEXT *parser, PT_NODE *limit, PT_OP_TYPE num_op, bool is_gby_num)
int db_value_to_enumeration_value(const DB_VALUE *src, DB_VALUE *result, const TP_DOMAIN *enum_domain)
int db_get_time_item(const DB_VALUE *src_date, const int item_type, DB_VALUE *result)
#define TP_MONETARY_AS_CHAR_LENGTH
PT_NODE * pt_semantic_type(PARSER_CONTEXT *parser, PT_NODE *tree, SEMANTIC_CHK_INFO *sc_info_ptr)
#define MILLISECONDS_OF_ONE_DAY
TP_DOMAIN * tp_domain_cache(TP_DOMAIN *transient)
#define PT_ERRORc(parser, node, msg)
#define TP_DATETIME_AS_CHAR_LENGTH
int csession_get_last_insert_id(DB_VALUE *value, bool update_last_insert_id)
int db_value_put_encoded_date(DB_VALUE *value, const DB_DATE *date)
int db_add_months(const DB_VALUE *src_date, const DB_VALUE *nmonth, DB_VALUE *result_date)
#define TP_BIGINT_PRECISION
int db_from_tz(DB_VALUE *time_val, DB_VALUE *tz, DB_VALUE *time_val_with_tz)
#define PT_IS_COLLECTION_TYPE(t)
int pt_coerce_value(PARSER_CONTEXT *parser, PT_NODE *src, PT_NODE *dest, PT_TYPE_ENUM desired_type, PT_NODE *data_type)
short db_value_is_in_workspace
#define TP_DATETIMETZ_AS_CHAR_LENGTH
#define db_private_free(thrd, ptr)
#define PT_SPEC_IS_CTE(spec_)
int db_to_number(const DB_VALUE *src_str, const DB_VALUE *format_str, const DB_VALUE *number_lang, DB_VALUE *result_num)
int db_json_depth_dbval(DB_VALUE *json, DB_VALUE *res)
#define OR_CHECK_SUB_UNDERFLOW(a, b, c)
int pt_check_same_datatype(const PARSER_CONTEXT *parser, const PT_NODE *p, const PT_NODE *q)
int numeric_db_value_mul(const DB_VALUE *dbv1, const DB_VALUE *dbv2, DB_VALUE *answer)
int db_string_aes_encrypt(DB_VALUE const *src, DB_VALUE const *key, DB_VALUE *result)
int tp_domain_add(TP_DOMAIN **dlist, TP_DOMAIN *domain)
#define SET_EXPECTED_DOMAIN(node, dom)
need_clear_type need_clear
int db_string_rlike(const DB_VALUE *src_string, const DB_VALUE *pattern, const DB_VALUE *case_sensitive, cub_regex_t **comp_regex, char **comp_pattern, int *result)
int db_get_cs_coll_info(DB_VALUE *result, const DB_VALUE *val, const int mode)
int db_date_diff(const DB_VALUE *date_value1, const DB_VALUE *date_value2, DB_VALUE *result)
int db_set_size(DB_SET *set)
int db_trunc_dbval(DB_VALUE *result, DB_VALUE *value1, DB_VALUE *value2)
#define PT_IS_CAST_MAYBE(node)
int pr_clear_value(DB_VALUE *value)
int pt_evaluate_function(PARSER_CONTEXT *parser, PT_NODE *func, DB_VALUE *dbval_res)
#define TP_TIME_AS_CHAR_LENGTH
DB_BIGINT db_get_bigint(const DB_VALUE *value)
#define MSGCAT_SEMANTIC_AGG_FUN_WANT_1_ARG
int db_get_date_from_days(const DB_VALUE *src, DB_VALUE *result)
int db_string_char_length(const DB_VALUE *string, DB_VALUE *char_count)
#define DB_DEFAULT_NUMERIC_PRECISION
int db_make_time(DB_VALUE *value, const int hour, const int minute, const int second)
bool pt_is_same_enum_data_type(PT_NODE *dt1, PT_NODE *dt2)
int db_make_datetimetz(DB_VALUE *value, const DB_DATETIMETZ *datetimetz)
struct db_domain_info::general_info general_info
#define ER_DATE_CONVERSION
#define PT_IS_FALSE_WHERE_VALUE(node)
int db_clob_to_char(const DB_VALUE *src_value, const DB_VALUE *codeset_value, DB_VALUE *result_value)
DB_METHOD * db_get_method(DB_OBJECT *obj, const char *name)
PT_NODE * parser_append_node(PT_NODE *node, PT_NODE *list)
char * pt_short_print(PARSER_CONTEXT *parser, const PT_NODE *node)
int db_last_day(const DB_VALUE *src_date, DB_VALUE *result_day)
TP_DOMAIN * pt_xasl_type_enum_to_domain(const PT_TYPE_ENUM type)
int db_inet_aton(DB_VALUE *result_numbered_ip, const DB_VALUE *string)
#define TP_IS_CHAR_TYPE(typeid)
#define OR_CHECK_UNS_SUB_UNDERFLOW(a, b, c)
TP_DOMAIN_COLL_ACTION collation_flag
bool pt_get_collation_info(PT_NODE *node, PT_COLL_INFER *coll_infer)
PT_NODE * parser_new_node(PARSER_CONTEXT *parser, PT_NODE_TYPE node_type)
#define MSGCAT_SEMANTIC_COERCE_UNSUPPORTED
int db_make_float(DB_VALUE *value, const DB_C_FLOAT num)
void parser_free_node(const PARSER_CONTEXT *parser, PT_NODE *node)
int db_date_add_interval_expr(DB_VALUE *result, const DB_VALUE *date, const DB_VALUE *expr, const int unit)
int db_string_to_base64(DB_VALUE const *src, DB_VALUE *result)
#define DB_DEFAULT_PRECISION
int sm_att_info(MOP classop, const char *name, int *idp, TP_DOMAIN **domainp, int *sharedp, int class_attr)
#define TP_TYPE_HAS_COLLATION(typeid)
int db_cos_dbval(DB_VALUE *result, DB_VALUE *value)
#define OR_CHECK_FLOAT_OVERFLOW(i)
short db_value_is_initialized
bool pt_is_json_path(PT_TYPE_ENUM type)
const char * lang_get_codeset_name(int codeset_id)
int pr_clone_value(const DB_VALUE *src, DB_VALUE *dest)
void parser_free_tree(PARSER_CONTEXT *parser, PT_NODE *tree)
enum collation_result COLLATION_RESULT
#define MSGCAT_SEMANTIC_FUNC_NOT_DEFINED_ON_INDEX
#define TP_INTEGER_PRECISION
#define PT_IS_RECURSIVE_EXPRESSION(node)
#define ER_AU_SELECT_FAILURE
int db_sqrt_dbval(DB_VALUE *result, DB_VALUE *value)
int db_convert_time_to_sec(const DB_VALUE *src_date, DB_VALUE *result)
PT_COLL_COERC_LEV coerc_level
#define PT_IS_PRIMITIVE_TYPE(t)
#define MSGCAT_SET_PARSER_SEMANTIC
void pt_try_remove_order_by(PARSER_CONTEXT *parser, PT_NODE *query)
int db_get_date_dayofyear(const DB_VALUE *src_date, DB_VALUE *result)
PT_NODE * pt_check_union_compatibility(PARSER_CONTEXT *parser, PT_NODE *node)
int db_hex(const DB_VALUE *param, DB_VALUE *result)
#define free_and_init(ptr)
char * db_get_database_version(void)
#define PT_IS_COMPLEX_TYPE(t)
int pt_common_collation(PT_COLL_INFER *arg1_coll_infer, PT_COLL_INFER *arg2_coll_infer, PT_COLL_INFER *arg3_coll_infer, const int args_w_coll, bool op_has_3_args, int *common_coll, INTL_CODESET *common_cs)
int db_string_trim(const MISC_OPERAND tr_operand, const DB_VALUE *trim_charset, const DB_VALUE *src_string, DB_VALUE *trimmed_string)
int db_json_extract_dbval(const DB_VALUE *json, const DB_VALUE *path, DB_VALUE *json_res)
int db_make_timestampltz(DB_VALUE *value, const DB_C_TIMESTAMP ts_val)
PT_NODE * pt_make_prim_data_type(PARSER_CONTEXT *parser, PT_TYPE_ENUM e)
char * prm_get_string_value(PARAM_ID prm_id)
#define PT_HAS_DATE_PART(t)
DB_DATE * db_get_date(const DB_VALUE *value)
int db_convert_to_time(const DB_VALUE *src_hour, const DB_VALUE *src_minute, const DB_VALUE *src_second, DB_VALUE *result)
DB_METHOD * db_get_class_method(DB_OBJECT *obj, const char *name)
#define ER_REGEX_EXEC_ERROR
PT_NODE * non_recursive_part
const char * tz_get_system_timezone(void)
#define ER_OBJ_INVALID_ARGUMENTS
int db_to_time(const DB_VALUE *src_str, const DB_VALUE *format_str, const DB_VALUE *date_lang, const DB_TYPE type, DB_VALUE *result_time)
int db_get_row_count_cache(void)
#define PT_IS_FUNCTION(n)
enum intl_codeset INTL_CODESET
int pt_is_comp_op(PT_OP_TYPE op)
bool pt_is_json_object_name(PT_TYPE_ENUM type)
LPOLESTR DBORDINAL flags BYTE precision
int db_radians_dbval(DB_VALUE *result, DB_VALUE *value)
int lang_set_flag_from_lang(const char *lang_str, bool has_user_format, bool has_user_lang, int *flag)
bool prm_get_bool_value(PARAM_ID prm_id)
int db_months_between(const DB_VALUE *start_mon, const DB_VALUE *end_mon, DB_VALUE *result_mon)
#define QSTR_IS_ANY_CHAR_OR_BIT(s)
DB_TIMESTAMP * db_get_timestamp(const DB_VALUE *value)
int db_get_string_size(const DB_VALUE *value)
int db_get_variable(DB_VALUE *name, DB_VALUE *value)
DB_C_SHORT db_get_short(const DB_VALUE *value)
int pt_is_single_tuple(PARSER_CONTEXT *parser, PT_NODE *select_node)
DB_C_CHAR db_get_enum_string(const DB_VALUE *value)
PT_NODE * after_cb_filter
int db_to_date(const DB_VALUE *src_str, const DB_VALUE *format_str, const DB_VALUE *date_lang, DB_VALUE *result_date)
#define TP_IS_DATE_TYPE(typeid)
int set_intersection(DB_COLLECTION *collection1, DB_COLLECTION *collection2, DB_COLLECTION **result, DB_DOMAIN *domain)
const char * tz_get_session_local_timezone(void)
#define TP_FLOATING_PRECISION_VALUE
char * pt_append_string(const PARSER_CONTEXT *parser, char *old_string, const char *new_tail)
int db_make_char(DB_VALUE *value, const int char_length, const DB_C_CHAR str, const int char_str_byte_size, const int codeset, const int collation_id)
int db_time_diff(const DB_VALUE *val1, const DB_VALUE *val2, DB_VALUE *result)
int db_crc32_dbval(DB_VALUE *result, DB_VALUE *value)
int db_least_or_greatest(DB_VALUE *arg1, DB_VALUE *arg2, DB_VALUE *result, bool least)
char * parser_print_tree(PARSER_CONTEXT *parser, const PT_NODE *node)
#define DB_VALUE_TYPE(value)
#define DB_CURRENCY_DEFAULT
int db_string_like(const DB_VALUE *src_string, const DB_VALUE *pattern, const DB_VALUE *esc_char, int *result)
bool pt_is_expr_wrapped_function(PARSER_CONTEXT *parser, const PT_NODE *node)
int pt_length_of_select_list(PT_NODE *list, int hidden_col)
int db_to_char(const DB_VALUE *src_value, const DB_VALUE *format_or_length, const DB_VALUE *lang_str, DB_VALUE *result_str, const TP_DOMAIN *domain)
int db_make_null(DB_VALUE *value)
PT_NODE * pt_fold_union(PARSER_CONTEXT *parser, PT_NODE *union_node, STATEMENT_SET_FOLD fold_as)
#define DB_IS_NULL(value)
int db_date_sub_interval_days(DB_VALUE *result, const DB_VALUE *date, const DB_VALUE *db_days)
int db_string_sha_two(DB_VALUE const *src, DB_VALUE const *hash_len, DB_VALUE *result)
#define pt_is_set_type(n)
bool pt_false_search_condition(PARSER_CONTEXT *parser, const PT_NODE *node)
enum pt_generic_type_enum PT_GENERIC_TYPE_ENUM
int db_make_double(DB_VALUE *value, const DB_C_DOUBLE num)
int db_mod_dbval(DB_VALUE *result, DB_VALUE *value1, DB_VALUE *value2)
int db_date_sub_interval_expr(DB_VALUE *result, const DB_VALUE *date, const DB_VALUE *expr, const int unit)
int db_json_insert(DB_VALUE *result, DB_VALUE *arg[], int const num_args)
int db_string_bit_length(const DB_VALUE *string, DB_VALUE *bit_count)
int db_get_schema_def_dbval(DB_VALUE *result, DB_VALUE *name_val)
int db_clob_from_file(const DB_VALUE *src_value, DB_VALUE *result_value)
int db_floor_dbval(DB_VALUE *result, DB_VALUE *value)
void db_date_decode(const DB_DATE *date, int *monthp, int *dayp, int *yearp)
DB_DATETIME * db_get_datetime(const DB_VALUE *value)
int db_char_to_clob(const DB_VALUE *src_value, DB_VALUE *result_value)
#define DB_MAX_VARNCHAR_PRECISION
int pt_evaluate_db_value_expr(PARSER_CONTEXT *parser, PT_NODE *expr, PT_OP_TYPE op, DB_VALUE *arg1, DB_VALUE *arg2, DB_VALUE *arg3, DB_VALUE *result, TP_DOMAIN *domain, PT_NODE *o1, PT_NODE *o2, PT_NODE *o3, PT_MISC_TYPE qualifier)
#define MSGCAT_RUNTIME_IS_NOT_AUTHORIZED_ON
#define MSGCAT_SEMANTIC_OP_NOT_DEFINED_ON
PT_NODE * pt_append_query_select_list(PARSER_CONTEXT *parser, PT_NODE *query, PT_NODE *attrs)
#define PT_INTERNAL_ERROR(parser, what)
#define TP_SMALLINT_PRECISION
int db_string_repeat(const DB_VALUE *src_string, const DB_VALUE *count, DB_VALUE *result)
int db_make_timestamp(DB_VALUE *value, const DB_C_TIMESTAMP timeval)
int db_make_int(DB_VALUE *value, const int num)
#define PT_IS_NUMERIC_TYPE(t)
int db_get_string_length(const DB_VALUE *value)
int db_conv(const DB_VALUE *num, const DB_VALUE *from_base, const DB_VALUE *to_base, DB_VALUE *result)
#define MSGCAT_SEMANTIC_ZERO_DIVIDE
int db_tz_offset(const DB_VALUE *src_str, DB_VALUE *result_str, DB_DATETIME *datetime)
int db_make_oid(DB_VALUE *value, const OID *oid)
enum pt_node_type PT_NODE_TYPE
PT_NODE * pt_domain_to_data_type(PARSER_CONTEXT *parser, DB_DOMAIN *domain)
int db_atan_dbval(DB_VALUE *result, DB_VALUE *value)
int db_sys_timezone(DB_VALUE *result_timezone)
XML_ParsingStatus * status
int numeric_db_value_add(const DB_VALUE *dbv1, const DB_VALUE *dbv2, DB_VALUE *answer)
#define TP_DOMAIN_CODESET(dom)
#define PT_HAS_COLLATION(t)
int db_typeof_dbval(DB_VALUE *result, DB_VALUE *value)
int db_clob_length(const DB_VALUE *src_value, DB_VALUE *result_value)
DB_TIME * db_get_time(const DB_VALUE *value)
int db_string_md5(DB_VALUE const *val, DB_VALUE *result)
int db_json_object(DB_VALUE *result, DB_VALUE *arg[], int const num_args)
int db_get_row_count(int *row_count)
#define INTL_CAN_COERCE_CS(cs_from, cs_to)
const char * au_user_name(void)
PT_NODE * pt_check_union_type_compatibility_of_values_query(PARSER_CONTEXT *parser, PT_NODE *node)
PT_NODE * pt_dbval_to_value(PARSER_CONTEXT *parser, const DB_VALUE *val)
#define MSGCAT_SEMANTIC_INCOMPATIBLE_OPDS
int db_abs_dbval(DB_VALUE *result, DB_VALUE *value)
void db_time_decode(DB_TIME *timeval, int *hourp, int *minutep, int *secondp)
int db_conv_tz(DB_VALUE *time_val, DB_VALUE *result_time)
int pt_length_of_list(const PT_NODE *list)
#define MSGCAT_SEMANTIC_FUNC_NOT_DEFINED_ON_3
int pt_coerce_value_for_default_value(PARSER_CONTEXT *parser, PT_NODE *src, PT_NODE *dest, PT_TYPE_ENUM desired_type, PT_NODE *data_type, DB_DEFAULT_EXPR_TYPE default_expr_type)
DB_VALUE * pt_value_to_db(PARSER_CONTEXT *parser, PT_NODE *value)
#define MSGCAT_SEMANTIC_OP_NOT_DEFINED_ON_3
#define TP_DATE_AS_CHAR_LENGTH
int db_string_extract_dbval(const MISC_OPERAND extr_operand, DB_VALUE *dbval_p, DB_VALUE *result_p, TP_DOMAIN *domain_p)
int setobj_size(COL *col)
PT_HOST_VAR_INFO host_var
int db_ceil_dbval(DB_VALUE *result, DB_VALUE *value)
#define OR_CHECK_MULT_OVERFLOW(a, b, c)
PT_NODE * parser_walk_tree(PARSER_CONTEXT *parser, PT_NODE *node, PT_NODE_WALK_FUNCTION pre_function, void *pre_argument, PT_NODE_WALK_FUNCTION post_function, void *post_argument)
TP_DOMAIN_COLL_ACTION collation_flag
#define PT_EXPR_INFO_IS_FLAGED(e, f)
#define PT_ERRORf(parser, node, msg, arg1)
#define PT_IS_NAME_NODE(n)
int db_get_string_codeset(const DB_VALUE *value)
#define ER_OBJ_INVALID_METHOD
#define MSGCAT_SEMANTIC_FUNCTION_NO_ARGS
int db_degrees_dbval(DB_VALUE *result, DB_VALUE *value)
PT_NODE * parser_copy_tree_list(PARSER_CONTEXT *parser, PT_NODE *tree)
#define ER_OBJ_NOT_A_CLASS
bool pt_is_symmetric_op(const PT_OP_TYPE op)
#define PT_ERRORmf(parser, node, setNo, msgNo, arg1)
unsigned is_hidden_column
int db_bit_to_blob(const DB_VALUE *src_value, DB_VALUE *result_value)
int db_get_date_week(const DB_VALUE *src_date, const DB_VALUE *mode, DB_VALUE *result)
PT_COMP_TO_BETWEEN_OP_CODE_TYPE
DB_C_BIT db_get_bit(const DB_VALUE *value, int *length)
#define PT_NAME_GENERATED_DERIVED_SPEC
#define PT_EXPR_INFO_CAST_COLL_MODIFIER
int db_like_bound(const DB_VALUE *const src_pattern, const DB_VALUE *const src_escape, DB_VALUE *const result_bound, const bool compute_lower_bound)
int db_value_domain_init(DB_VALUE *value, const DB_TYPE type, const int precision, const int scale)
#define TP_DOMAIN_COLLATION_FLAG(dom)
int pt_evaluate_function_w_args(PARSER_CONTEXT *parser, FUNC_TYPE fcode, DB_VALUE *args[], const int num_args, DB_VALUE *result)
int tz_datetimetz_fix_zone(const DB_DATETIMETZ *src_dt_tz, DB_DATETIMETZ *dest_dt_tz)
DB_C_CHAR db_get_string(const DB_VALUE *value)
#define DB_MAX_CHAR_PRECISION
int db_width_bucket(DB_VALUE *result, const DB_VALUE *value1, const DB_VALUE *value2, const DB_VALUE *value3, const DB_VALUE *value4)